php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46830 unexpected termination
Submitted: 2008-12-11 02:57 UTC Modified: 2008-12-11 08:21 UTC
Votes:9
Avg. Score:4.4 ± 0.8
Reproduced:7 of 7 (100.0%)
Same Version:6 (85.7%)
Same OS:6 (85.7%)
From: ncross42 at cyworld dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.8 OS: Ubuntu-8.04.1-server
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: ncross42 at cyworld dot com
New email:
PHP Version: OS:

 

 [2008-12-11 02:57 UTC] ncross42 at cyworld dot com
Description:
------------
This bug is a apache-thread related php excution bug.

This bug is repeatable and clear.

1. System setting.
 a. apache-2.2.10 : mpm=worker and using shared modules.
-=-=-= httpd.conf =-=-=-
for simple test, values are low.
<IfModule worker.c>
StartServers        1
MinSpareThreads     2
MaxSpareThreads     4
ThreadsPerChild     2   # <- this is important.
MaxRequestsPerChild 5   # <- this is important.
</IfModule>

 b. PHP-5.2.8 : using apxs2 and enable-maintainer-zts for threadsafe
(no external cache like APC or XCache)


Reproduce code:
---------------
-=-= code of 1.php =-=-
<?php
 echo '1<br>';

 echo date("H:i:s").'<br>';
sleep(10);
 echo date("H:i:s").'<br>';
?>

-=-= code of 2.php =-=-
<?php
 echo '2<br>';

 echo date("H:i:s").'<br>';
 echo date("H:i:s").'<br>';
?>


Expected result:
----------------
<bug scenario>

 (a) browse 1.php and 2.php <concurrently ONCE>. result are not problem.
-=-= result page of 1.php =-=-
1
11:04:29
11:04:39
-=-= result page of 2.php =-=-
2
11:04:30
11:04:30

 (b) I expected ...
  - browse 1.php and 2.php
  - refresh 2.php over 10 times very fast within 10 sec. (yes, using F5)
  - I expected below normal resuluts.
-=-= result page of 1.php =-=-
1
11:12:47
11:12:49
-=-= result page of 2.php =-=-
2
11:12:49
11:12:49

Actual result:
--------------
<ANALYSIS>

 (a) initial apache process is here
Shell> ps ax | grep httpd
 5697 ?        Ss     0:00 /skcomms/apache/bin/httpd -k restart
 5964 ?        Sl     0:00 /skcomms/apache/bin/httpd -k restart
  - becuase below apache setting
<IfModule worker.c>
StartServers        1
MinSpareThreads     2
ThreadsPerChild     2
...
</IfModule>

 (b) suppose
  - in (a) action, two connection is established with process 5964
  - in (b) action, new 1.php is sleeping in 5964 and 2.php is excuted in other new process because below reason.
<IfModule worker.c>
...
ThreadsPerChild     2
MaxRequestsPerChild 5
</IfModule>

 (c) expected in 1.php excution time (within 10 sec)
 5697 ?        Ss     0:00 /skcomms/apache/bin/httpd -k restart
 5964 ?        Sl     0:00 /skcomms/apache/bin/httpd -k restart (1.php is sleeping here)
 597x ?        Sl     0:00 /skcomms/apache/bin/httpd -k restart (2.php is browsed here)

 (d) but actually 5964 is terminated early in 2 seconds.
 5697 ?        Ss     0:00 /skcomms/apache/bin/httpd -k restart
 5991 ?        Sl     0:00 /skcomms/apache/bin/httpd -k restart


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-11 03:06 UTC] ncross42 at cyworld dot com
sorry, i don't submitted Actual results.
here is Actual results.
-=-= result page of 1.php =-=-
1
11:49:00
11:49:02
-=-= result page of 2.php =-=-
2
11:49:02
11:49:02
 [2008-12-11 04:24 UTC] ncross42 at cyworld dot com
sorry again.
There is wrong expected results.
-=-= result page of 1.php =-=-
1
11:12:47
11:12:49  <- this is bug results.
-=-= result page of 2.php =-=-
2
11:12:49
11:12:49


-=-= result page of 1.php =-=-
1
11:12:47
11:12:57  <- I expected like this!! (sleeping 10 sec)
-=-= result page of 2.php =-=-
2
11:12:57  <- this value is meaningless
11:12:57  <- but for fast refresh.
 [2008-12-11 08:21 UTC] ncross42 at cyworld dot com
I have a reply from Apach maintainer.

"The php manual has comments saying sleep() wakes up when you receive any signal
(like the traditional C library call documents, man 3 sleep)

Termination due to MaxRequestsPerchild is implemented via a signal."

So, this is not a bug. :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC