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

Fix 73783 : pcntl_signal() not handling SIG_IGN correctly #2246

Closed
wants to merge 2 commits into from

Conversation

bp1222
Copy link
Contributor

@bp1222 bp1222 commented Dec 19, 2016

Bug #73783 raises an issue with signal handling when using SIG_IGN.
With PHP7.1 ZEND_SIGNALS is defaulted to on, which will for all
signals set the handler as zend_signal_handler_defer. This is
problematic for syscalls like sleep(), which will only return when the
requisite number of seconds have elapsed, or, a non-ignored signal is
raised. In this case we want to SIG_IGN SIGCHLD, however, SIG_IGN is
only stored in the SIGG(handlers) array, and the actual system level
handler is defined. This prevents proper signal ignoring when requeted.

@bp1222 bp1222 changed the base branch from PHP-7.1.0 to PHP-7.1 December 20, 2016 01:04
Bug #73783 raises an issue with signal handling when using SIG_IGN.
With PHP7.1 ZEND_SIGNALS is defaulted to on, which will for all
signals set the handler as zend_signal_handler_defer.  This is
problematic for syscalls like sleep(), which will only return when the
requisite number of seconds have elapsed, or, a non-ignored signal is
raised.  In this case we want to SIG_IGN SIGCHLD, however, SIG_IGN is
only stored in the SIGG(handlers) array, and the actual system level
handler is defined.  This prevents proper signal ignoring when requeted.
@php-pulls
Copy link

Comment on behalf of krakjoe at php.net:

labelling

@php-pulls php-pulls added the Bug label Dec 21, 2016
@nikic
Copy link
Member

nikic commented Dec 22, 2016

Patch looks fine to me. Is it possible to add a test for this without jumping through too many hoops?

@bp1222
Copy link
Contributor Author

bp1222 commented Dec 22, 2016

Done. Looking closer, it'd seem to me with ZEND_SIGNALS turned on by default now, pcntl signal stuff could probably itself be wrapped up in a ifndef ZEND_SIGNALS, and have wrapper stuff to just use the zend-signal storage. Seems to be no point in maintaining two sets of signal-handling and tracking code. I could potentially look at this later to clean it up

@nikic
Copy link
Member

nikic commented Dec 29, 2016

Merged via b09c2f8, thanks!

@nikic nikic closed this Dec 29, 2016
@bp1222 bp1222 deleted the fix-73783 branch December 29, 2016 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants