-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
set_time_limit() counts time while pg_get_result() waiting for asynchronous PostgreSQL query #14769
Comments
The code worked as expected in PHP 8.1, until I upgraded to PHP 8.3. I think it should not count time while the PHP script is doing nothing but waiting for the PostgreSQL server. I did not find any documentation about this change in code behaviour. |
I have tried with the following cases :
In every case I get my OK. |
Thanks for the quick reply. Indeed, the code works as it should on Ubuntu, I tried it too. I have two very different Gentoo systems with PHP 8.3 and both produces the bug. I also tested PHP 8.2 on Gentoo (same configuration) and got the OK. It's weird, seems like a Gentoo specific bug on version 8.3. |
As another datapoint, 8.3.8 on Windows times out as well. |
I tried version 8.3.6 and 8.3.3 on Gentoo and both throws the error. |
I think I found the problem, the error depends on whether thread safety is enabled or not. If I compile PHP 8.3.8 on Gentoo without threads, the above code works as should. But if I compile PHP with POSIX threads, the code breaks. On Ubuntu the PHP 8.3.6 is compiled without threads, that's why it's working okay. |
does it work with ZTS and in a non async way ? e.g. just pg_query |
Suprisingly, the script times out in non-async / blocking mode too:
|
I ll have a look in the following days. |
Anybody using mysql ? If yes what happens with ZTS build with 'SELECT SLEEP(5)' query? |
I tried mysqli extension with MariaDB and the PHP script times out as well. Code:
|
Even PHP's sleep() function times out with ZTS enabled:
Without ZTS, there is no timeout. |
Ok gonna bisect it. I think that s better support Linux timeouts with ZTS part but will double-check. |
Was wrong about the commit, @lezso6, if you build from source, can you add |
I recompiled with ZTS enabled and Zend Max Execution Timers disabled, and the bug is gone. It works, no timeouts. |
It appears on the migration guide. Distribution packagers would need to modify their build workflow to take it into account. |
So if I understand correctly, this is a feature. And will be enabled for non-ZTS builds, I read that here: #6504 (comment) |
Description
The following code:
Resulted in this output:
But I expected this output instead:
PHP Version
8.3.8
Operating System
Gentoo Linux
The text was updated successfully, but these errors were encountered: