php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79464 ZTS builds do not properly respect max_execution_time
Submitted: 2020-04-10 10:19 UTC Modified: 2020-05-11 14:01 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: maroszek at gmx dot net Assigned:
Status: Open Package: *General Issues
PHP Version: master-Git-2020-04-10 (Git) OS: Linux, MacOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: maroszek at gmx dot net
New email:
PHP Version: OS:

 

 [2020-04-10 10:19 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-28 10:43 UTC] 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-05-11 14:01 UTC] nikic@php.net
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.
 [2020-05-11 14:12 UTC] maroszek at gmx dot net
Unfortunately SIGEV_THREAD_ID seems to be Linux-specific (http://man7.org/linux/man-pages/man2/timer_create.2.html) and we would need to find another solution for Mac OS. 

Do you think it is worth the effort to fix the problem for Linux only at the moment and leave it open for Mac OS?

Thanks for looking into it!
 [2024-01-20 08:52 UTC] njmcdirectproject at gmail dot com
Thanks... Nice information . www.njmcdirect.com ticket payment online to new jersey court
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC