-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #81206: Multiple PHP processes crash with JIT enabled #7208
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
Conversation
The fix for bug 80175 (PR php#6268) broke most SAPIs wrt. JIT, most notably cgi-fcgi, because for these SAPIs `SUCCESSFULLY_REATTACHED` actually has to set the `reattached` flag.
This comment has been minimized.
This comment has been minimized.
What's the relevant difference between apache2handler and other SAPIs here? Can you add a code comment for why it has special handling? |
Actually, that may only be relevant for |
We need to avoid resetting the JIT for all SAPIs, but we need to initialize the JIT handlers even when only reattaching on Windows.
Well, after more debugging I found that there is no relevant difference between the SAPIs here at all. The problem is just that we need to initialize the tracing JIT handlers for tracing even when reattaching on Windows. The new patch does this in the most simple way, namely by ignoring Note that it was sufficient for the OP to just revert 2a545ba, because they had |
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.
Ah yes, this makes sense. The stubs themselves are in SHM to which we reattach, but we need to reload the pointers to those stubs in per-process memory.
Why is this? The handlers are defaulted to NULL, and only inited currently in zend_jit_make_stubs() - I don't see any other place where they are initialized, nor any special behaviour for *nix - am I missing something here? |
@dktapps, I think that re-attaching is a Windowes only thing. |
I eventually managed to answer my own question - fork() is used everywhere except Windows, and SHM reattach is only done from forked subprocess on non-Windows. In a forked subprocess these handlers would already be initialized anyway because of the forking. |
The fix for bug 80175 (PR #6268) broke most SAPIs wrt. JIT, most
notably cgi-fcgi, because for these SAPIs
SUCCESSFULLY_REATTACHED
actually has to set the
reattached
flag.I'm not sure whether some other APIs might need to be handled as well:
php-src/ext/opcache/ZendAccelerator.c
Lines 2601 to 2612 in 65bd8d2
What is "uwsgi"?