Edit report at https://bugs.php.net/bug.php?id=50551&edit=1
ID: 50551 Comment by: webmaster at bluesting dot co dot za Reported by: r dot badding at gmail dot com Summary: mb_ereg + mb_eregi crash Status: Feedback Type: Bug Package: mbstring related Operating System: win32 only - Windows XP PHP Version: 5.2.12 Block user comment: N Private report: N New Comment: 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/ Previous Comments: ------------------------------------------------------------------------ [2011-09-20 08:40:10] paj...@php.net @webmaster at bluesting dot co dot za Please provide a small reproduce script for the crashes you are experiencing. It could be due to something totally different. Also be sure to use 5.3.8 or snaps. ------------------------------------------------------------------------ [2011-09-20 07:58:33] webmaster at bluesting dot co dot za I have had very similar issues! At first I never noticed mb_ereg issues or crashes, until I started running some apache benchmarks on unrelated code to simulate server load, and noticed strange crashes. I eventually isolated the crashes to mb_ereg related code. To benchmark code with Apache Benchmark, I was using the "ab" command under apache/bin directory like this: ab -t 30 -c 10 http://localhost/ With some mb_ereg code running in the very beginning (doing url detection). The actual code is actually not important because I get crashes with every combination I try! I think using Apache Benchmark is better than running this code in a loop because it will create 10 simultaneous connections simulating higher load instead of just the one connection. When I convert my code to use preg_match_all() ... I have NO issues! Only mb_ereg related functions causing crashes! I tried mb_ereg() and mb_ereg_search_init() + mb_ereg_search_regs() with the same unpredictable crashes! Try the code above with Apache Benchmark and the commands I gave above, you should definately be able to simulate this issue! ------------------------------------------------------------------------ [2010-08-12 00:19:52] ka...@php.net Have you tried on 5.3? I cannot reproduce it trunk and Vista x86 with memory_limit=128MB and configure --enable-mbstring --enable-mbregex (no backtrack stack) ------------------------------------------------------------------------ [2010-01-02 17:04:34] r dot badding at gmail dot com Still getting the same crash with the snapshot php-5.2-win32-VC6-x86- latest. I made sure I had the correct extension dir in php.ini and no other php5ts.dll were found than the one in the snapshot. I think I haven't screwed up anything, but of course there's always that possibility. Don't think so though. ------------------------------------------------------------------------ [2009-12-30 14:43:24] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Try the snap. Maybe it was fixed as I can't reproduce this. And when you reply, use the "Edit submission" tab! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=50551 -- Edit this bug report at https://bugs.php.net/bug.php?id=50551&edit=1