Edit report at https://bugs.php.net/bug.php?id=52752&edit=1

 ID:                 52752
 Comment by:         jani dot ollikainen at mmd dot net
 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:

Oh and here's the backtraces for the production enviroment using PHP 5.3.3, APC 
3.1.13 on CentOS 6 (x86_64). Backtrace have two options but still problem seems 
to be the same:

Core was generated by `/usr/bin/php-cgi'.
Program terminated with signal 7, Bus error.
#0  lex_scan (zendlval=0x7fff2f98cf48) at Zend/zend_language_scanner.c:931
931                     if (yych != '<') goto yy4;
(gdb) list
926                     };
927
928                     YYDEBUG(0, *YYCURSOR);
929                     YYFILL(8);
930                     yych = *YYCURSOR;
931                     if (yych != '<') goto yy4;
932                     YYDEBUG(2, *YYCURSOR);
933                     yyaccept = 0;
934                     yych = *(YYMARKER = ++YYCURSOR);
935                     if (yych <= '?') {

(gdb) bt
#0  lex_scan (zendlval=0x7fff901eca58) at Zend/zend_language_scanner.c:931
#1  0x000000000058deb0 in zendlex (zendlval=0x7fff901eca50)
    at /usr/src/debug/php-5.3.3/Zend/zend_compile.c:4942
#2  0x00000000005786f7 in zendparse ()
    at /usr/src/debug/php-5.3.3/Zend/zend_language_parser.c:3282
#3  0x0000000000583342 in compile_file (file_handle=0x7fff901edfe0,
    type=<value optimized out>) at Zend/zend_language_scanner.l:354
#4  0x00007f413988da8f in my_compile_file (h=0x7fff901edfe0, type=2)
    at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:532
#5  0x00007f4134c64721 in phar_compile_file (file_handle=0x7fff901edfe0,
    type=2) at /usr/src/debug/php-5.3.3/ext/phar/phar.c:3393
#6  0x00000000005d8148 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (
    execute_data=0x1263560)
    at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:5179
#7  0x00000000005cc810 in execute (op_array=0x11f5ce0)
    at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107
#8  0x00000000005a6f4d in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /usr/src/debug/php-5.3.3/Zend/zend.c:1194
#9  0x00000000005551b8 in php_execute_script (primary_file=0x7fff901f07b0)
    at /usr/src/debug/php-5.3.3/main/main.c:2261
#10 0x000000000063081d in main (argc=1, argv=0x7fff901f29c8)
    at /usr/src/debug/php-5.3.3/sapi/cgi/cgi_main.c:2127

(gdb) bt
#0  lex_scan (zendlval=0x7fffa8dc3898) at Zend/zend_language_scanner.c:931
#1  0x000000000058deb0 in zendlex (zendlval=0x7fffa8dc3890)
    at /usr/src/debug/php-5.3.3/Zend/zend_compile.c:4942
#2  0x00000000005786f7 in zendparse ()
    at /usr/src/debug/php-5.3.3/Zend/zend_language_parser.c:3282
#3  0x0000000000583342 in compile_file (file_handle=0x7fffa8dc5340,
    type=<value optimized out>) at Zend/zend_language_scanner.l:354
#4  0x00007f55ee3c65b7 in apc_compile_cache_entry (key=0x7fffa8dc5170,
    h=0x7fffa8dc5340, type=2, t=<value optimized out>,
    op_array=0x7fffa8dc40b8, cache_entry=0x7fffa8dc40c0)
    at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:398
#5  0x00007f55ee3c6f9b in my_compile_file (h=0x7fffa8dc5340, type=2)
    at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:603
#6  0x00007f55e979d721 in phar_compile_file (file_handle=0x7fffa8dc5340,
    type=2) at /usr/src/debug/php-5.3.3/ext/phar/phar.c:3393
#7  0x00000000005d8148 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (
    execute_data=0x1e26370)
    at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:5179
#8  0x00000000005cc810 in execute (op_array=0x1d187e0)
    at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107
#9  0x00000000005a6f4d in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /usr/src/debug/php-5.3.3/Zend/zend.c:1194
#10 0x00000000005551b8 in php_execute_script (primary_file=0x7fffa8dc7b10)
    at /usr/src/debug/php-5.3.3/main/main.c:2261
#11 0x000000000063081d in main (argc=1, argv=0x7fffa8dc9d28)
    at /usr/src/debug/php-5.3.3/sapi/cgi/cgi_main.c:2127


Previous Comments:
------------------------------------------------------------------------
[2012-12-19 13:09:36] jani dot ollikainen at mmd dot net

This problem is wider than the report says! It's not just Centos 5 and 32bit. 
Tested with 5.3.19, 5.4.9 and trunk 201212191230 and got bus error.

Suggested workaround by disabling mmap seems to work, so problem lies
in mmap handling. Real fix/patch would be nice and really appreciated.

5.3.19:
Core was generated by `sapi/cli/php test3.php'.
Program terminated with signal 7, Bus error.
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1709
1709                    switch (*YYCURSOR++) {
(gdb) list
1704    }
1705
1706
1707    <ST_IN_SCRIPTING>"#"|"//" {
1708            while (YYCURSOR < YYLIMIT) {
1709                    switch (*YYCURSOR++) {
1710                            case '\r':
1711                                    if (*YYCURSOR == '\n') {
1712                                            YYCURSOR++;
1713                                    }
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1709
#1  0x0000000000636640 in zendlex (zendlval=0x7fff2476cb90)
    at /root/php-5.3.19/Zend/zend_compile.c:4975
#2  0x0000000000620e66 in zendparse ()
    at /root/php-5.3.19/Zend/zend_language_parser.c:3285
#3  0x000000000062bb52 in compile_file (file_handle=0x7fff2476ce80,
    type=<value optimized out>) at Zend/zend_language_scanner.l:364
#4  0x00000000005362d1 in phar_compile_file (file_handle=0x7fff2476ce80,
    type=2) at /root/php-5.3.19/ext/phar/phar.c:3394
#5  0x000000000062b3de in compile_filename (type=2, filename=0x185ac58)
    at Zend/zend_language_scanner.l:407
#6  0x000000000067c63e in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (
    execute_data=0x7fe9b5916050)
    at /root/php-5.3.19/Zend/zend_vm_execute.h:1967
#7  0x0000000000675a30 in execute (op_array=0x184f358)
    at /root/php-5.3.19/Zend/zend_vm_execute.h:107
#8  0x000000000064f86f in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /root/php-5.3.19/Zend/zend.c:1259
#9  0x00000000005fcd67 in php_execute_script (primary_file=0x7fff24770780)
    at /root/php-5.3.19/main/main.c:2316
#10 0x00000000006da002 in main (argc=2, argv=0x7fff24770a18)
    at /root/php-5.3.19/sapi/cli/php_cli.c:1189

PHP 5.4.9:
Core was generated by `sapi/cli/php test3.php'.
Program terminated with signal 7, Bus error.
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1904
1904                    switch (*YYCURSOR++) {
(gdb) list
1899    }
1900
1901
1902    <ST_IN_SCRIPTING>"#"|"//" {
1903            while (YYCURSOR < YYLIMIT) {
1904                    switch (*YYCURSOR++) {
1905                            case '\r':
1906                                    if (*YYCURSOR == '\n') {
1907                                            YYCURSOR++;
1908                                    }
(gdb) bt
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1904
#1  0x000000000063fd90 in zendlex (zendlval=0x7fff4739ebf0)
    at /root/php-5.4.9/Zend/zend_compile.c:6707
#2  0x0000000000628ba4 in zendparse ()
    at /root/php-5.4.9/Zend/zend_language_parser.c:3430
#3  0x0000000000634d4d in compile_file (file_handle=0x7fff4739ef40,
    type=<value optimized out>) at Zend/zend_language_scanner.l:582
#4  0x0000000000539ae1 in phar_compile_file (file_handle=0x7fff4739ef40,
    type=2) at /root/php-5.4.9/ext/phar/phar.c:3388
#5  0x00000000006344ae in compile_filename (type=2, filename=0x7f66ed826d20)
    at Zend/zend_language_scanner.l:625
#6  0x00000000006acb6b in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (
    execute_data=0x7f66ed7ea060) at /root/php-5.4.9/Zend/zend_vm_execute.h:2608
#7  0x00000000006c98a0 in execute (op_array=0x7f66ed81f938)
    at /root/php-5.4.9/Zend/zend_vm_execute.h:410
#8  0x00000000006608cd in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /root/php-5.4.9/Zend/zend.c:1309
#9  0x0000000000603e27 in php_execute_script (primary_file=0x7fff473a2680)
    at /root/php-5.4.9/main/main.c:2482
#10 0x000000000070aeac in do_cli (argc=2, argv=0x7fff473a2a88)
    at /root/php-5.4.9/sapi/cli/php_cli.c:988
#11 0x000000000070b608 in main (argc=2, argv=0x7fff473a2a88)
    at /root/php-5.4.9/sapi/cli/php_cli.c:1364

trunk:
Core was generated by `sapi/cli/php test3.php'.
Program terminated with signal 7, Bus error.
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1917
1917                    switch (*YYCURSOR++) {
(gdb) list
1912    }
1913
1914
1915    <ST_IN_SCRIPTING>"#"|"//" {
1916            while (YYCURSOR < YYLIMIT) {
1917                    switch (*YYCURSOR++) {
1918                            case '\r':
1919                                    if (*YYCURSOR == '\n') {
1920                                            YYCURSOR++;
1921                                    }
(gdb) bt
#0  lex_scan (zendlval=<value optimized out>)
    at Zend/zend_language_scanner.l:1917
#1  0x0000000000641c30 in zendlex (zendlval=0x7fff34ca46c0)
    at /root/php-trunk-201212191230/Zend/zend_compile.c:6881
#2  0x000000000062a713 in zendparse ()
    at /root/php-trunk-201212191230/Zend/zend_language_parser.c:3428
#3  0x0000000000636d75 in compile_file (file_handle=0x7fff34ca4a30,
    type=<value optimized out>) at Zend/zend_language_scanner.l:585
#4  0x000000000053a921 in phar_compile_file (file_handle=0x7fff34ca4a30,
    type=2) at /root/php-trunk-201212191230/ext/phar/phar.c:3388
#5  0x000000000063641e in compile_filename (type=2, filename=0x7f6444584978)
    at Zend/zend_language_scanner.l:628
#6  0x00000000006d48eb in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (
    execute_data=0x7f64445481e0)
    at /root/php-trunk-201212191230/Zend/zend_vm_execute.h:2695
#7  0x00000000006d4b40 in execute_ex (execute_data=0x7f64445481e0)
    at /root/php-trunk-201212191230/Zend/zend_vm_execute.h:356
#8  0x00000000006634d9 in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /root/php-trunk-201212191230/Zend/zend.c:1309
#9  0x0000000000605ed9 in php_execute_script (primary_file=0x7fff34ca8180)
    at /root/php-trunk-201212191230/main/main.c:2468
#10 0x0000000000710d7c in do_cli (argc=2, argv=0x7fff34ca8588)
    at /root/php-trunk-201212191230/sapi/cli/php_cli.c:988
#11 0x00000000007114d8 in main (argc=2, argv=0x7fff34ca8588)
    at /root/php-trunk-201212191230/sapi/cli/php_cli.c:1364

------------------------------------------------------------------------
[2012-04-26 21:17:04] michael at vstadi dot com

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

------------------------------------------------------------------------
[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?

------------------------------------------------------------------------


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

Reply via email to