Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we catch signals that could cause semaphores to leak? #856

Open
jbaublitz opened this issue May 17, 2023 · 1 comment
Open

Should we catch signals that could cause semaphores to leak? #856

jbaublitz opened this issue May 17, 2023 · 1 comment
Projects

Comments

@jbaublitz
Copy link
Member

We recently bumped into a problem where stratisd was leaking semaphores on SIGTERM. Should we add in signal handling for the semaphore code?

@bmr-cymru @mulkieran Curious on your thoughts.

@bmr-cymru
Copy link
Member

Generally it's more common for libraries to leave signal handling to the calling application - e.g. this is what happens in lvm2/libdevmapper. Whenever lvm2 is holding a VG lock it blocks signals (this encompasses DM device activation as well as things like metadata updates). If we followed that approach in Stratis then stratisd would block signals before operating on DM devices.

Alternately we could try to handle this internally in devicemapper but give users the ability to opt out if they want to do their own signal handling. I think that's possible and would mean changing UdevSync to block/unblock signals around operations. This could be gated by a feature for clients that don't want that behaviour.

The only thing I'm uncertain of is how this will interact with threading - if I remember correctly blocked signals are per-thread, so by blocking signals in the thread that's processing a DM operation we'd still have the possibility of SIGTERM/SIGINT being delivered to another thread in the process. I'm not certain what would happen in this case and whether we'd need to block signals in other threads (or in the main thread before starting other threads) to prevent an abrupt termination of stratisd.

@mulkieran mulkieran removed this from To do in 2023May Jun 5, 2023
@mulkieran mulkieran added this to To do in 2023June via automation Jun 5, 2023
@mulkieran mulkieran moved this from To do to In progress (long term) in 2023June Jun 5, 2023
@mulkieran mulkieran removed this from In progress (long term) in 2023June Jul 10, 2023
@mulkieran mulkieran added this to To do in 2023July via automation Jul 10, 2023
@mulkieran mulkieran removed this from To do in 2023July Aug 7, 2023
@mulkieran mulkieran added this to To do in 2023August via automation Aug 7, 2023
@mulkieran mulkieran removed this from To do in 2023August Aug 31, 2023
@mulkieran mulkieran added this to To do in 2023September via automation Aug 31, 2023
@mulkieran mulkieran removed this from To do in 2023September Oct 3, 2023
@mulkieran mulkieran added this to To do in 2023October via automation Oct 3, 2023
@mulkieran mulkieran removed this from To do in 2023October Oct 30, 2023
@mulkieran mulkieran added this to To do in 2023November via automation Oct 30, 2023
@mulkieran mulkieran removed this from To do in 2023November Nov 30, 2023
@mulkieran mulkieran added this to To do in 2023December via automation Nov 30, 2023
@mulkieran mulkieran removed this from To do in 2023December Jan 2, 2024
@mulkieran mulkieran added this to To do in 2024January via automation Jan 2, 2024
@mulkieran mulkieran removed this from To do in 2024January Feb 5, 2024
@mulkieran mulkieran added this to To do in 2024February via automation Feb 5, 2024
@mulkieran mulkieran removed this from To do in 2024February Mar 5, 2024
@mulkieran mulkieran added this to To do in 2024March via automation Mar 5, 2024
@mulkieran mulkieran removed this from To do in 2024March Apr 2, 2024
@mulkieran mulkieran added this to To do in 2024April via automation Apr 2, 2024
@mulkieran mulkieran removed this from To do in 2024April Apr 29, 2024
@mulkieran mulkieran added this to To do in 2024May via automation Apr 29, 2024
@mulkieran mulkieran removed this from To do in 2024May May 28, 2024
@mulkieran mulkieran added this to To do in 2024June via automation May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

2 participants