-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Consider disabling JIT by default #1924
Comments
That's probably not a bad idea. |
Meanwhile, it has been pointed out that the default config of But I'll let you be the judge of that... |
The |
The latest update today seems to have caused segmentation faults and a PHP-FPM gateway failure. It is possible that our configuration is odd, though. Setting opcache to disabled temporarily worked, so maybe it's an unrelated issue there... Our config is held in
Perhaps setting a buffer size and then disabling JIT is not a supported combination. |
You can try enabling the jit again with |
I didn't want to disable the opcache completely in case that people know it works for them and they want to re-enable it. |
opcache.enabled = 1 without opcache.jit_buffer_size=1280K works. opcache.jit=tracing or =function with or without opcache.jit_buffer_size=1280K does not seem to work, even after I moved the config file to 99-[sitename].conf so it's applied after 10-opcache.conf. Which is odd since in theory it should be disabled without buffer. I can't debug much on the live site at our busiest time so I'll have to defer further experimentation for now, at least. As you say JIT often does not provide a benefit, but it did seem to have a small benefit for our use-case, so we were using it. |
This is definitely weird and should be reported upstream. If there are more reports, I think the sane thing to do would be to disable the OPcache JIT at the compile time. |
I did a bit more debugging since PHP 8.1 CLI scripts continued to segfault in some cases, which turned out to be zend_accel_inheritance_cache_find at ./ext/opcache/ZendAccellerator.c:2261 (possibly It looks like clearing out the old files in the I had been upgrading from version 8.1.15-1 to 8.1.15-3 (20230203.33 to 20230207.35) when the issue was triggered. |
This was pretty annoying to find, as I tried everything to enable the JIT but of course no change to the |
I think like @AgentOak , if anybody have problems with JIT, then don't enable it. The worst think, is that is a silent change. Only if you check if it's enabled, you will investigate why it isn't. What is the percentage of apps having problems? 1-10% ? 50% ? |
Defaults:
Some people only see @PowerKiKi commented php/php-src#7817 (comment) So JIT is always disabled by default. @oerdnj Please review this change. |
If any dev want to check if is enabled. Please use: I found this problem creating a test for Ngx-php: And also need to change it for the Techempower benchmark: TechEmpower/FrameworkBenchmarks#8130 |
I think there is now accepted RFC to change ini in php 8.4 so it will be clear if it is enabled or not |
For now, check oerdnj/deb.sury.org#1924
https://www.php.net/manual/en/opcache.configuration.php claims that the default is |
@tim-hitchins-ekkosense https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit-buffer-size |
@joanhey yes, I know that - I'm pointing out that the documentation is wrong for the specific setting of |
https://wiki.php.net/rfc/jit_config_defaults It's accepted, but for PHP 8.4. |
Indeed, this kills the JIT. But, as the RFC notes, not in 8.4. Perhaps "Set by default" would be better terminology, but I imagine the argument would be that it's indeed enabled, just has no space to do anything. As always your best advice is to set the config you want explicitly rather than rely on upstream or package defaults. |
Sorry, understood, thanks |
Frequently asked questions
Describe the bug
For a little more than 1 year a few people reported segfaults in PHP when JIT is enabled. Until now the only clear solution to avoid those is to either entirely disable JIT, or at least configure it with the flag
1205
(or equivalentfunction
).The JIT author himself said that the current JIT version is buggy, hard to debug, and "often almost useless for real-life apps". He also happens to be working on a new JIT version, so it seems unlikely he would have time to investigate complex bugs in the coming months.
So the current situation is that the default configuration of PHP is subject to segfault that are unlikely to be fixed quickly. The workaround around that is to simply configure PHP to not use JIT. There doesn't seem to be any downside "for real-life apps".
To Reproduce
Unfortunately there is no clear reproduction steps
Your understanding of what is happening
Some hard-to-reproduce race conditions might corrupt the JIT engine, leading to sporadic segfaults.
What steps did you take to resolve issue yourself before reporting it here
Manually configure JIT to be
disable
.Expected behavior
I expect default PHP configuration to never segfaults. So it should be changed to either
disable
orfunction
. And if advanced users who know what they are doing actually need it, they can always re-enable it.Distribution (please complete the following information):
Package(s) (please complete the following information):
The text was updated successfully, but these errors were encountered: