Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

pal_signal: add missing mutex unlock when SIGCHLD==SIG_IGN#29843

Merged
stephentoub merged 1 commit intodotnet:masterfrom
tmds:fix_missing_unlock
May 22, 2018
Merged

pal_signal: add missing mutex unlock when SIGCHLD==SIG_IGN#29843
stephentoub merged 1 commit intodotnet:masterfrom
tmds:fix_missing_unlock

Conversation

@tmds
Copy link
Copy Markdown
Member

@tmds tmds commented May 22, 2018

Child reapping was changed to be triggered by the SIGCHLD signal (#26291).
As part of that change, code was added to handle the original handler being SIG_IGN.
In that case, there was a missing mutex unlock.

Fixes https://github.com/dotnet/corefx/issues/29841.

cc: @wfurt @janvorli @mateusrodrigues

Child reapping was changed to be triggered by the SIGCHLD signal (dotnet#26291).
As part of that change, code was added to handle the original handler being SIG_IGN.
In that case, there was a missing mutex unlock.

Fixes https://github.com/dotnet/corefx/issues/29841.
@tmds
Copy link
Copy Markdown
Member Author

tmds commented May 22, 2018

Some background:
When SIGCHLD is set to SIG_DFL, then the signal doesn't do anything.
When a user sets SIGCHLD to SIG_IGN, then the kernel will clean up the children without requiring the application to waitpid. So when we override that signal, we are responsible for cleaning up those zombies.
It is not likely a user will do this, it was part of #26291 mostly for completeness.

@stephentoub
Copy link
Copy Markdown
Member

It is not likely a user will do this

Isn't SIG_IGN the default disposition for SIGCHLD?

@stephentoub stephentoub merged commit 50d6137 into dotnet:master May 22, 2018
stephentoub pushed a commit to stephentoub/corefx that referenced this pull request May 22, 2018
)

Child reapping was changed to be triggered by the SIGCHLD signal (dotnet#26291).
As part of that change, code was added to handle the original handler being SIG_IGN.
In that case, there was a missing mutex unlock.

Fixes https://github.com/dotnet/corefx/issues/29841.
@tmds
Copy link
Copy Markdown
Member Author

tmds commented May 22, 2018

Isn't SIG_IGN the default disposition for SIGCHLD?

The naming is confusing. The default disposition is to ignore SIGCHLD (SIG_DFL), and this is different from when the disposition is set to SIG_IGN.

From the man page: http://man7.org/linux/man-pages/man2/sigaction.2.html

POSIX.1-1990 disallowed setting the action for SIGCHLD to SIG_IGN.
POSIX.1-2001 and later allow this possibility, so that ignoring
SIGCHLD can be used to prevent the creation of zombies (see wait(2)).
Nevertheless, the historical BSD and System V behaviors for ignoring
SIGCHLD differ, so that the only completely portable method of
ensuring that terminated children do not become zombies is to catch
the SIGCHLD signal and perform a wait(2) or similar.

@karelz karelz added this to the 3.0 milestone Jun 2, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…refx#29843)

Child reapping was changed to be triggered by the SIGCHLD signal (dotnet/corefx#26291).
As part of that change, code was added to handle the original handler being SIG_IGN.
In that case, there was a missing mutex unlock.

Fixes https://github.com/dotnet/corefx/issues/29841.

Commit migrated from dotnet/corefx@50d6137
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants