Bug #79464 [Opn]: ZTS builds do not properly respect max_execution_time
| From: | nikic@php.net | Date: | Mon, 11 May 2020 14:01:25 +0000 |
| Subject: | Bug #79464 [Opn]: ZTS builds do not properly respect max_execution_time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226998@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79464&edit=1
ID: 79464
Updated by: nikic@php.net
Reported by: maroszek at gmx dot net
Summary: ZTS builds do not properly respect
max_execution_time
Status: Open
Type: Bug
Package: *General Issues
Operating System: Linux, MacOS
PHP Version: master-Git-2020-04-10 (Git)
Block user comment: N
Private report: N
New Comment:
On Linux the timeout functionality is based on setitimer, which is a per-process mechanism. That
seems fundamentally incompatible with ZTS.
A possible alternative might be to use timer_create() with SIGEV_THREAD_ID.
Previous Comments:
------------------------------------------------------------------------
[2020-04-28 10:43:21] maroszek at gmx dot net
Hi!
Can i provide any more details to reproduce the problem?
Do you have any hints on how a fix could look like? I would be willing to try to build a fix/patch
if you could point me into the right direction.
Thanks in advance!
------------------------------------------------------------------------
[2020-04-10 10:19:38] maroszek at gmx dot net
Description:
------------
Tested against today's master. Also affects 7.x
Only affects Linux and MacOS. Windows builds work fine.
Please see my simple ZTS example: https://gist.github.com/paresy/3cbd4c6a469511ac7479aa0e7c42fea7
Compile:
g++ php.cpp -Imain -ITSRM -IZend -I. --std=c++11 -Llibs -lphp -lresolv -ldl -pthread
I used a minimal PHP build: ./configure '--disable-fpm' '--disable-cgi'
'--disable-cli' '--enable-embed=static' '--enable-maintainer-zts'
'--disable-all'
Adding '--disable-zend-signals' does not change the result.
Might correlate with this issue: https://bugs.php.net/bug.php?id=16820
Test script:
---------------
<?php
set_time_limit(2);
for (;;) ; // Busy wait
Expected result:
----------------
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
Actual result:
--------------
Fatal error: Maximum execution time of 2 seconds exceeded in /home/symcon/Downloads/php-src/test.php
on line 3
FINISHED
(The remaining 4 threads hang indefinitely)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79464&edit=1