You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
max_execution_time counts wall time on ZTS builds, CPU time elsewhere #25499
max_execution_time should mean the same thing whatever the build. Today it counts CPU time on Linux, as the manual says ("database queries, etc. is not included"), but wall time on builds with Zend Max Execution Timers, on by default for ZTS on Linux and FreeBSD, since #10141 switched from CPU time during review.
This caught us by surprise moving a Symfony app from FPM to FrankenPHP: with the same php.ini, requests waiting for the lock of their session file started dying at 10 seconds, where FPM never counted that wait. A build option shouldn't redefine a setting everybody shares an understanding of.
timer_create() accepts CLOCK_THREAD_CPUTIME_ID on Linux, so these timers could count the CPU time of their thread, as setitimer() does everywhere else. A wall-time limit has its uses, but as its own setting, as proposed in https://wiki.php.net/rfc/max_execution_wall_time, not as a different meaning of this one.
FWIW, I think wall time probably makes more sense since it's easier to reason about with, and a lot of timeouts are going to be spent waiting on i.e. remote database servers, where you're waiting on reads/writes.
We discussed that extensively when I introduced Zend Max Execution Timers, and IIRC, the historical behavior of counting CPU-time was there only because legacy reasons, but has never been wanted/intended.
IMHO the long term goal should be to move on wall time everywhere, not to add extra options.
I think trying to redefine the definition used by the vast majority of the ecosystem is a mistake, especially on a niche platform - ZTS and its derivates are niche let's be honest about this.
I'd rather write the de facto definition in plain text somewhere as the only valid one and introduce another concept if we want wall-time limit.
Activity
NattyNarwhal commentedon Nov 17, 2026
Note that some platforms can only do wall time regardless, it's a bit of a mess:
php-src/Zend/zend_signal.c
Line 66 in 4bc158b
Then you have hard timeout in NTS but not ZTS!
FWIW, I think wall time probably makes more sense since it's easier to reason about with, and a lot of timeouts are going to be spent waiting on i.e. remote database servers, where you're waiting on reads/writes.
dunglas commentedon Nov 17, 2026
We discussed that extensively when I introduced Zend Max Execution Timers, and IIRC, the historical behavior of counting CPU-time was there only because legacy reasons, but has never been wanted/intended.
IMHO the long term goal should be to move on wall time everywhere, not to add extra options.
See also #13468
dunglas commentedon Nov 17, 2026
Also, IIRC, @arnaud-lb and @bukka worked on a POC adding signal-less timeouts support for all platforms, but I don't know the status of this work.
nicolas-grekas commentedon Nov 17, 2026
I think trying to redefine the definition used by the vast majority of the ecosystem is a mistake, especially on a niche platform - ZTS and its derivates are niche let's be honest about this.
I'd rather write the de facto definition in plain text somewhere as the only valid one and introduce another concept if we want wall-time limit.
dunglas commentedon Nov 17, 2026
This has been extensively discussed here: https://externals.io/message/118859