-
-
Notifications
You must be signed in to change notification settings - Fork 251
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: properly close context on worker script timeouts and crashes. #1184
Conversation
Hmmm... I think there must be an issue somewhere. In |
The issue is, if it times out during execution, it will exit from the whole script, not just the current |
I don't think I understand. Wouldn't this be the same as doing an |
This was intended. I'm not sure that it's the best behavior, but it looked more secure to me, especially because workers are restarted anyway. |
@withinboredom on timeout it will not behave the same as on exit. On timeout it will stop the whole script and execution is continued after I'm not sure if the behavior was always this way, but it behaves this way on the newest PHP 8.3 version. |
Ok I think I get it. This looks like a good fix. WDYT @withinboredom ? |
Thank!! |
I noticed that PHP timeouts will fully stop the script's execution and not just continue to the next iteration in worker mode.
This PR fixes this issue in part by making sure the context gets closed if a worker request is still pending and the PHP script returned a non-zero status code.
To reproduce, just set
max_execution_time = 2
in thephp.ini
and execute a worker script withsleep(3);
. Ideally, timeouts would not stop the script execution (if that's even possible).