-
Notifications
You must be signed in to change notification settings - Fork 7.9k
PHP 8.3.7 with JIT encounters infinite loop on specific paths #14475
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
Comments
/cc @dstogov |
I don't see any problems running the provided example. It records and executes just a single trace. It seems, in your environment the trace is invalidated (for some reason) then recorded and executed again. Try to run the code with |
yes, the file may has changed during execution also the file mtime
I was set jit_debug=0x1fffff in GDB and this part are hit It looks like this code are hit in
the process still running with GDB attached, any other info I can provided? |
In case some of the files is changed on each "request", the trace is going to be invalidated and recompiled on each "request". It's better to add this file in the opcache blacklist. I understood, the problem occurs only after the "max_root_traces" limit is exceeded. Right? It would be great if you could construct a test case. This way I will able to fix the exact problem. |
My usage scenario involves a specific PHP script managing the execution of other PHP scripts, ensuring that the updated script content is used immediately upon file modification. I am unsure whether JIT is necessary for this type of requirement.
Please disregard my speculation, I am not familiar with the implementation of this part.
This is a script running in our test environment. I'm not sure if it can be isolated for reproduction. I'll try to see. |
It's better to disable not only JIT, but also opcache, because your invalidated scripts re-cached again and again. Instead of complete disabling you may blacklist specific files.
I just trying to interpret your reference to the code: |
I have a large number of scripts to execute, and script updates are relatively infrequent. Would disabling opcache have any performance or anything else implications?
I've tried isolating the relevant code, but the issue hasn't been reproduced in a short period. The affected script has been running the management process for over a week. Apart from reproducing the script, is there any information that can be obtained from the running process to help troubleshoot this issue? I can provide this kind information for now. |
@dstogov no idea how you came to the conclusion that provided snippet works (with exact |
The issue was reproduced after running with the -dopcache.jit_debug=0x1ff105 option for a few days. after TRACE 1023 (reach max_root_traces?), the issue happened as above described
Is anything else needed? |
@dstogov for me your patch works well. |
@Appla without a reproduction, I can only guess about your case. |
Description
I noticed that a PHP script was consuming a very high amount of CPU. I used strace to investigate and found that it was repeatedly executing fcntl. I used GDB to trace the process and found that it was continuously looping through a specific code path, as detailed in the following quote.
One scenario is that our script is hosted under a PHP process, where the host process forks a child process to execute the specific code.
zbacktrace
shows code in PHP land blocking onself::$traceAt = now();
PHP Version
PHP 8.3.7
Operating System
Rocky Linux 8
The text was updated successfully, but these errors were encountered: