Edit report at https://bugs.php.net/bug.php?id=52752&edit=1
ID: 52752 Comment by: michael at vstadi dot com Reported by: paulgao at yeah dot net Summary: Program terminated with signal 7, Bus error. Status: Feedback Type: Bug Package: Scripting Engine problem Operating System: Centos 5 32bit PHP Version: 5.3SVN-2010-08-31 (SVN) Block user comment: N Private report: N New Comment: We are experiencing the same thing: CentOS5, Nginx 1.1.12, PHP-FPM 5.3.10, (extensions APC 3.1.9 and memcache 2.2.6) Occasional SIGBUS, [26-Apr-2012 17:05:23] WARNING: [pool www] child 2562 exited on signal 7 (SIGBUS - core dumped) after 84.407806 seconds from start gdb core dump and backtrace: Core was generated by `php-fpm:'. Program terminated with signal 7, Bus error. #0 lex_scan (zendlval=0x7fffd5e9fde8) at Zend/zend_language_scanner.c:943 943 if (yych != '<') goto yy4; (gdb) bt #0 lex_scan (zendlval=0x7fffd5e9fde8) at Zend/zend_language_scanner.c:943 #1 0x0000000000591ee0 in zendlex (zendlval=0x7fffd5e9fde0) at /usr/src/debug/php-5.3.10/Zend/zend_compile.c:4975 #2 0x000000000057c6a6 in zendparse () at /usr/src/debug/php-5.3.10/Zend/zend_language_parser.c:3287 #3 0x0000000000587352 in compile_file (file_handle=0x7fffd5ea1360, type=<value optimized out>) at Zend/zend_language_scanner.l:364 #4 0x00007f02feaf344f in my_compile_file (h=0x7fffd5ea1360, type=8) at /usr/src/debug/php-pecl-apc-3.1.9/APC-3.1.9/apc_main.c:543 #5 0x00007f02f8b7f291 in phar_compile_file (file_handle=0x7fffd5ea1360, type=8) at /usr/src/debug/php-5.3.10/ext/phar/phar.c:3393 #6 0x0000000000586bde in compile_filename (type=8, filename=0x2a97418) at Zend/zend_language_scanner.l:407 #7 0x00000000005d8442 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER ( execute_data=0x294c6a8) at /usr/src/debug/php-5.3.10/Zend/zend_vm_execute.h:22529 #8 0x00000000005d1770 in execute (op_array=0x2a43d58) at /usr/src/debug/php-5.3.10/Zend/zend_vm_execute.h:107 #9 0x00000000005a197a in zend_call_function (fci=0x7fffd5ea16f0, fci_cache=<value optimized out>) at /usr/src/debug/php-5.3.10/Zend/zend_execute_API.c:969 #10 0x00000000004f6e33 in zif_call_user_func (ht=<value optimized out>, return_value=0x2b39d68, return_value_ptr=<value optimized out>, this_ptr=<value optimized out>, return_value_used=<value optimized out>) at /usr/src/debug/php-5.3.10/ext/standard/basic_functions.c:4774 #11 0x00000000005fa0d8 in zend_do_fcall_common_helper_SPEC ( execute_data=<value optimized out>) at /usr/src/debug/php-5.3.10/Zend/zend_vm_execute.h:320 #12 0x00000000005d1770 in execute (op_array=0x2a64df8) at /usr/src/debug/php-5.3.10/Zend/zend_vm_execute.h:107 #13 0x00000000005ab2bd in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.3.10/Zend/zend.c:1236 #14 0x0000000000558558 in php_execute_script (primary_file=0x7fffd5ea3ea0) at /usr/src/debug/php-5.3.10/main/main.c:2308 #15 0x000000000063e269 in main (argc=44076704, argv=0x2a08bc0) at /usr/src/debug/php-5.3.10/sapi/fpm/fpm/fpm_main.c:1858 Previous Comments: ------------------------------------------------------------------------ [2012-02-08 09:58:10] vc at artstyle dot ru About the only way - disable use of mmap() on PHP code files. Need to patch and recompile. Something like this: --- main/main.c~ 2012-02-08 06:00:52.000000000 +0400 +++ main/main.c 2012-02-08 06:01:28.000000000 +0400 @@ -1229,7 +1229,7 @@ /* can we mmap immeadiately? */ memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); len = php_zend_stream_fsizer(stream TSRMLS_CC); - if (len != 0 + if (0 && len != 0 #if HAVE_MMAP && ((len - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD #endif ------------------------------------------------------------------------ [2012-02-07 18:57:30] mbreid at thepei dot com I believe I'm running into this exact same error. I'm new to PHP-FPM (v5.3.9) as well as GDB, so here's what I managed to pull from the "core dump" / gdb backtrace log: Core was generated by `php-fpm: pool www '. Program terminated with signal 7, Bus error. #0 lex_scan (zendlval=0x7fffbe65e368) at Zend/zend_language_scanner.l:1801 1801 if (*YYCURSOR == '\'') { AND #0 lex_scan (zendlval=0x7fffbe65e368) at Zend/zend_language_scanner.l:1801 #1 0x000000000076fe90 in zendlex (zendlval=0x7fffbe65e360) at /usr/src/install/php-5.3.9/Zend/zend_compile.c:4975 #2 0x00000000007598ae in zendparse () at /usr/src/install/php-5.3.9/Zend/zend_language_parser.c:3285 #3 0x0000000000765268 in compile_file (file_handle=0x7fffbe65e6e0, type=2) at Zend/zend_language_scanner.l:364 #4 0x00000000005ee40a in phar_compile_file (file_handle=<value optimized out>, type=<value optimized out>) at /usr/src/install/php-5.3.9/ext/phar/phar.c:3393 #5 0x00000000007b88ac in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (execute_data=0x31432a8) at /usr/src/install/php-5.3.9/Zend/zend_vm_execute.h:5234 #6 0x00000000007ad538 in execute (op_array=0x32c4900) at /usr/src/install/php-5.3.9/Zend/zend_vm_execute.h:107 #7 0x000000000078806a in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3) at /usr/src/install/php-5.3.9/Zend/zend.c:1236 #8 0x000000000073686d in php_execute_script (primary_file=<value optimized out>) at /usr/src/install/php-5.3.9/main/main.c:2308 #9 0x0000000000817545 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/install/php-5.3.9/sapi/fpm/fpm/fpm_main.c:1858 I'm running Ubuntu 10.10 (64-bit) -- Any ideas one what could be happening here or ways to address this moving forward? ------------------------------------------------------------------------ [2011-12-22 23:56:52] vc at artstyle dot ru Test case: # cat test3.php <?php if ($argv[1] > 0) { while ($argv[1]--) file_put_contents('test.tpl', "<?php #".str_repeat('A', mt_rand(4000, 5000))." ?>\n", LOCK_EX); } else { $p2 = popen("php test3.php 100", "r"); while (1) include 'test.tpl'; } ?> # php test3.php Bus error # php test3.php Bus error # php test3.php Bus error # php test3.php PHP Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /var/tmp/test.tpl on line 1 Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /var/tmp/test.tpl on line 1 In my case it's an application (Bitrix) to blame. Ugly code that frequently rewrites cached template in place, instead of creating new and renaming it. ------------------------------------------------------------------------ [2011-12-22 22:36:53] vc at artstyle dot ru Same here. Apache doesn't matter, I've get this SIGBUS couple times a day. With APC or xcache different versions,latest - all the same. PHP is stock Debian: PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 13:13:26) Using fastcgi SAPI with pretty large PHP application (thousands of files). I'll try to make it reproducible. # gdb /usr/lib/cgi-bin/php5-fcgi ./3002.php5-fcgi.7.9143 [...] Program terminated with signal 7, Bus error. #0 lex_scan (zendlval=0xbfffa2ec) at /build/buildd-php5_5.3.3-7+squeeze3-i386-H_HNTR/php5-5.3.3/Zend/zend_language_scanner.c:940 940 yych = *YYCURSOR; (gdb) l 935 0, 0, 0, 0, 0, 0, 0, 0, 936 }; 937 938 YYDEBUG(0, *YYCURSOR); 939 YYFILL(8); 940 yych = *YYCURSOR; 941 if (yych != '<') goto yy4; 942 YYDEBUG(2, *YYCURSOR); 943 yyaccept = 0; 944 yych = *(YYMARKER = ++YYCURSOR); (gdb) p language_scanner_globals.yy_cursor $1 = (unsigned char *) 0xb77c1000 <Address 0xb77c1000 out of bounds> (gdb) inf target Symbols from "/usr/lib/cgi-bin/php5-fcgi". Local core dump file: `/var/tmp/./3002.php5-fcgi.7.9143', file type elf32-i386. [...] 0xb7759000 - 0xb7781000 is load52 0xb77c1000 - 0xb77c1000 is load53 0xb77c2000 - 0xb77c5000 is load54 [...] ------------------------------------------------------------------------ [2011-10-31 21:32:30] juraj at lutter dot sk This same happens on Solaris 10/x86 with PHP 5.3.8 compiled using GCC4 and using Apache 2.2.21. root@[nwebs3 /var/crash/nwebs3]# pstack httpd-29691-cust_zend_apache3 core 'httpd-29691-cust_zend_apache3' of 29691: /opt/csw/apache2/sbin/httpd -f /opt/csw/apache2/etc/httpd.conf -k star fe0485d4 lex_scan (8046c74, 6c632f61, 746e6569, fe062825, 69762f63, 72656c6c) + 60 fe062863 zendlex (8046c70, 8045ae0, 8045690, fe04344b) + 4f fe043ac2 zendparse (85af794, 2, 40, 2, 81c3ecc, 9) + 69a fe047cd1 compile_file (8046e00, 8, 2, fe3630c8, 81f399c, 85b1265) + bd fdd7706c sg_compile_file (8046e00, 8, 55, 0, fe3ae224, 31) + 20 fe0abaac ???????? (8047800, 81c3e12, 8046e98, fe3ae0c0, 88b39c8, 1007800) fe0945d9 execute (81e10b4, 0, 2, 81c3ba8, 8046ecc, 8046ed4) + 195 fe074111 zend_execute_scripts (8, 0, 3, 0, 8047800, 0) + 129 fe0255af php_execute_script (8047800, 8380c78, 9c, fe0f72a9, fdc20000, 8000) + 1df fe0f7508 ???????? (8386cd0, 25, 8386fb0, 8387f60) 0807cdce ap_run_handler (8386cd0, 3b, 8047ae8, 807d135, 11e1a300, 0) + 32 0807d19f ap_invoke_handler (8386cd0, 0, 8047b18, 80712de) + af 08087fdd ap_process_request (8386cd0, 4, 8386cd0, 8386cd0) + 18d 0808599d ap_process_http_connection (837cf40, 0, 8047b78, 8082aed) + f1 08082802 ap_run_process_connection (837cf40, 837cca8, 837cc68, 80bcdd8, fec42c40, 0) + 32 0808c34a child_main (10, 808beb8, 1, 0) + 406 0808c52e make_child (fddc1a5e, feb7667a, fec43c80, 6, 0, fec43c80) + de 0808d0ae ap_mpm_run (80be830, 80ec8e8, 80c0728, 80c0728) + aea 0806c9e4 main (6, 8047e08, 8047e24) + 6f8 0806be7c _start (6, 8047ea8, 8047ec4, 8047ec7, 8047ee7, 8047eea) + 80 ------------------------------------------------------------------------ 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=52752 -- Edit this bug report at https://bugs.php.net/bug.php?id=52752&edit=1