php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50086 [PATCH] - Avoid invoking setitimer when timeouts have been disabled
Submitted: 2009-11-05 09:11 UTC Modified: 2009-11-05 10:39 UTC
From: yoarvi at gmail dot com Assigned:
Status: Closed Package: Performance problem
PHP Version: 6SVN-2009-11-05 (SVN) OS: Solaris 5.10 (SPARC)
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: yoarvi at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-05 09:11 UTC] yoarvi at gmail dot com
Description:
------------
When compiled with #ifdef ZTS, the setitimer calls in zend_unset_timeout show up as a performance hotspot even when 
max_execution_time and max_input_time are set to 0 in php.ini.

(Originally posted to the internals list - http://marc.info/?l=php-internals&m=125689761124706&w=2)

Reproduce code:
---------------
The following patch avoids invoking zend_unset_timeout (and thereby the expensive setitimer call within) when timeouts have been disabled via settings in php.ini


diff -r d0dddebae3a2 main/main.c
--- a/main/main.c	Mon May 04 18:11:50 2009 +0200
+++ b/main/main.c	Fri Aug 28 17:35:25 2009 +0530
@@ -1602,7 +1602,9 @@
 	} zend_end_try();
 
 	zend_try {
-		zend_unset_timeout(TSRMLS_C);
+		if (EG(timeout_seconds) != 0) {
+			zend_unset_timeout(TSRMLS_C);
+		}
 	} zend_end_try();
 }
 
@@ -1702,7 +1704,9 @@
 
 	/* 12. Reset max_execution_time */
 	zend_try {
-		zend_unset_timeout(TSRMLS_C);
+		if (EG(timeout_seconds) != 0) {
+			zend_unset_timeout(TSRMLS_C);
+		}
 	} zend_end_try();
 
 #ifdef PHP_WIN32


Expected result:
----------------
Improved multi-threaded performance.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-05 10:39 UTC] dmitry@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 20:01:35 2025 UTC