|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-22 00:37 UTC] r dot badding at gmail dot com
Description:
------------
When I make two request to the attached php file, in close proximity (so
that the requests run at the same time), PHP crashes every time.
If I modify the php file so that there are two mb_ereg calls, instead of
one mb_ereg + one mb_eregi, I seem to get no crashes.
Reproduce code:
---------------
<?
for ($i = 0; $i < 5000000; $i++)
{
mb_ereg("searching", "some text some text");
mb_eregi("searching", "some text some text");
}
?>
Expected result:
----------------
No crashes.
Actual result:
--------------
Crash.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 25 05:00:01 2025 UTC |
So I was worried that it was my version as I was using 5.2.14, I have now also tested 5.2.17 and 5.3.8 with the same results! I have disabled all extentions except: extension=php_mbstring.dll And I have tested the code on 2 different machines, an AMD and an Intel. Apache 2.0 and 2.2. index.php <?php echo mb_ereg('^/', $_SERVER['REQUEST_URI']); Running this line once as normal in your browser, there are no issues! But once you run this line with Apache Benchmark, Apache/PHP will crash. Now it's possible that it's Apache, however I have run multiple benchmarks on all kinds of code without crashes and on 2 different versions of Apache, only this single line of code keeps crashing PHP/Apache. If I convert the code to preg_match() or preg_match_all() I have no issues! To run Apache Benchmarks on this code, use: ab -t 30 -c 10 http://localhost/ Note: "ab" is found in your Apache "bin" directory. This will run the benchmark for 30 seconds with 10 concurrent connections: In "ab" I sometimes get the following message: apr_socket_recv: An existing connection was forcibly closed by the remote host. But this is usually after Apache/PHP has crashed! The crashes occur randomly and unpredictably. Sometimes early in the benchmark, sometimes late. Sometimes Apache crashes, sometimes it can continue normally. PS: I've tested this now on a fresh install of the thread safe 5.3.8 (32 bit on WinXP) with no other extentions enabled in php.ini. I've also tested both Apache 2.0 and 2.2, on 2 different dev machines, an AMD & Intel machine. If this is working for you, then try increasing the time limit and concurrent connections eg. ab -t 180 -c 50 http://localhost/