-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix bug #76895 #4461
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 bug #76895 #4461
Conversation
@dstogov Can you please check this? |
Could not comment the code, just tested in my environment with daf0c95 and b62c6e5 instead of #4460 patch. In addition to usual
a new line appears in logs while processing request to the buggy file
Reload does not stuck any more. |
Hm, this part isn't good. That means that some codepath can still leave signals blocked, which the opcache change was intended to avoid (and did for the compilation error case in my tests). |
I hope, that build was without other patches, so |
#ifdef ZEND_SIGNALS | ||
zend_signal_deactivate(); | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, it's not a good idea to add several syscalls on each request. May be enable this only in DEBUG build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just drop the SIGNAL_BEGIN_CRITICAL in zend_signal_deactivate? Then there shouldn't be any syscalls, and I don't see a reason why this needs to block signals during the reset, as long as active=0 is set first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
@nikic This looks fine, except for overhead of zend_signal_deactivate(). |
@dstogov I've pushed a few additional changes to zend_signal_deactivate. The use of a critical section is removed, the signal queue is cleaned up and SIGG(check) is now enabled based on ZEND_DEBUG. |
There are two parts here: First, opcache should not be blocking signals while invoking compile_file. Second, we should have noticed this issue a long time ago, but apparently we don't use zend_signal_deactivate as part of the standard shutdown sequence. In addition to calling deactivate, also make sure that we always check for zero depth, independent of SIGG(check), which is currently not enabled.
looks fine |
Merged as 38f1288 into 7.2. |
Thank you for the fix, I do not see additional errors mentioned above (in #4461 (comment)) any more. I have tried a test for this bug #76895 with changes to |
There are two parts here: First, opcache should not be blocking signals while invoking compile_file. This both means that signals may be blocked for a very long time (compile_file may execute PHP code) and that we will not unblock signals if a bailout occurs, which happens on any compile error.
Second, we should have noticed this issue a long time ago, but apparently we don't use zend_signal_deactivate as part of the standard shutdown sequence. In addition to calling deactivate, also make sure that we always check for zero depth, independent of SIGG(check), which is currently not enabled.
Fixes bug #76895.