Skip to content

Opcache bad signal 139 crash in ZTS bookworm (frankenphp) #16727

Closed
@AlliBalliBaba

Description

@AlliBalliBaba

Description

When starting an application that has lots of php files (Laravel) I sometimes get a crash with 'bad signal' 139.
I don't know if this is limited to the ZTS build of PHP, but it happens in the ZTS FrankenPHP bookworm Docker Image (PHP 8.3.15) with opcache and opcache_cli enabled.

The backtrace from the core-dump:

#0  runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:154
#1  0x000000000045d0fb in runtime.raisebadsignal (sig=11, c=0xc00078fa50) at /usr/local/go/src/runtime/signal_unix.go:987
#2  0x000000000045d547 in runtime.badsignal (sig=11, c=0xc00078fa50) at /usr/local/go/src/runtime/signal_unix.go:1096
#3  0x000000000045bda8 in runtime.sigtrampgo (sig=11, info=0xc00078fbf0, ctx=0xc00078fac0) at /usr/local/go/src/runtime/signal_unix.go:468
#4  0x0000000000481126 in runtime.sigtramp () at /usr/local/go/src/runtime/sys_linux_amd64.s:352
#5  <signal handler called>
#6  0x00007f38055478b6 in zend_mm_alloc_small (heap=0x7f376c400040, bin_num=16,
    __zend_filename=0x7f3805fcdbc0 "/usr/local/src/php/Zend/zend_opcode.c", __zend_lineno=1051, __zend_orig_filename=0x0, __zend_orig_lineno=0)     
    at /usr/local/src/php/Zend/zend_alloc.c:1312
#7  0x00007f3805548471 in zend_mm_realloc_heap (heap=0x7f376c400040, ptr=0x7f376c472000, size=272, use_copy_size=false, copy_size=240, 
    __zend_filename=0x7f3805fcdbc0 "/usr/local/src/php/Zend/zend_opcode.c", __zend_lineno=1051, __zend_orig_filename=0x0, __zend_orig_lineno=0)     
    at /usr/local/src/php/Zend/zend_alloc.c:1609
#8  0x00007f380554ac5f in _erealloc (ptr=0x7f376c472000, size=240, __zend_filename=0x7f3805fcdbc0 "/usr/local/src/php/Zend/zend_opcode.c",
    __zend_lineno=1051, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /usr/local/src/php/Zend/zend_alloc.c:2634
#9  0x00007f380557d083 in pass_two (op_array=0x7f376c533ca8) at /usr/local/src/php/Zend/zend_opcode.c:1051
#10 0x00007f3805564c5f in zend_compile_func_decl (result=0x0, ast=0x7f376c519f00, toplevel=false) at /usr/local/src/php/Zend/zend_compile.c:7698    
#11 0x00007f380556d3b6 in zend_compile_stmt (ast=0x7f376c519f00) at /usr/local/src/php/Zend/zend_compile.c:10427
#12 0x00007f380556071a in zend_compile_stmt_list (ast=0x7f376c519dd0) at /usr/local/src/php/Zend/zend_compile.c:6405
#13 0x00007f380556d28b in zend_compile_stmt (ast=0x7f376c519dd0) at /usr/local/src/php/Zend/zend_compile.c:10374
#14 0x00007f380555de79 in zend_compile_if (ast=0x7f376c519f60) at /usr/local/src/php/Zend/zend_compile.c:5643
#15 0x00007f380556d368 in zend_compile_stmt (ast=0x7f376c519f60) at /usr/local/src/php/Zend/zend_compile.c:10414
#16 0x00007f380556d04a in zend_compile_top_stmt (ast=0x7f376c519f60) at /usr/local/src/php/Zend/zend_compile.c:10352
#17 0x00007f380556cf57 in zend_compile_top_stmt (ast=0x7f376c4ecb98) at /usr/local/src/php/Zend/zend_compile.c:10338
#18 0x00007f380550b718 in zend_compile (type=2) at Zend/zend_language_scanner.l:618
#19 0x00007f380550b8dc in compile_file (file_handle=0x7f3788df7360, type=8) at Zend/zend_language_scanner.l:653
#20 0x00007f38052ea915 in phar_compile_file (file_handle=0x7f3788df7360, type=8) at /usr/local/src/php/ext/phar/phar.c:3352
#21 0x00007f379a26f93c in opcache_compile_file (file_handle=0x7f3788df7360, type=8, op_array_p=0x7f3788df72f8)
    at /usr/local/src/php/ext/opcache/ZendAccelerator.c:1817
#22 0x00007f379a2713e7 in persistent_compile_file (file_handle=0x7f3788df7360, type=8) at /usr/local/src/php/ext/opcache/ZendAccelerator.c:2147
#23 0x00007f380550bb85 in compile_filename (type=8, filename=0x4048f030) at Zend/zend_language_scanner.l:704
#24 0x00007f38055d31c1 in zend_include_or_eval (inc_filename_zv=0x7f376c4143b0, type=8) at /usr/local/src/php/Zend/zend_execute.c:4946
#25 0x00007f380563842d in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER () at /usr/local/src/php/Zend/zend_vm_execute.h:39836
#26 0x00007f380565df51 in execute_ex (ex=0x7f376c414020) at /usr/local/src/php/Zend/zend_vm_execute.h:60595
#27 0x00007f380565efc9 in zend_execute (op_array=0x7f376c46d000, return_value=0x0) at /usr/local/src/php/Zend/zend_vm_execute.h:61604
#28 0x00007f38055928f2 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php/Zend/zend.c:1895
#29 0x00007f38054ca91c in php_execute_script (primary_file=0x7f3788df8b00) at /usr/local/src/php/main/main.c:2528
#30 0x00000000019b1f44 in frankenphp_execute_script (file_name=0x0) at frankenphp.c:954
#31 0x00000000019afb47 in _cgo_b21416d01a02_Cfunc_frankenphp_execute_script (v=0xc00061fdd8) at /tmp/go-build/cgo-gcc-prolog:74
#32 0x000000000047f244 in runtime.asmcgocall () at /usr/local/go/src/runtime/asm_amd64.s:918
#33 0x000000c000444700 in ?? ()
#34 0x00007f3788df8c70 in ?? ()
#35 0x00007f380617e5c0 in ?? () from /usr/local/lib/libphp.so
#36 0x000000c0005d4808 in ?? ()
#37 0x00007f3788df8cd8 in ?? ()
#38 0x00000000005539e1 in crosscall2 () at /usr/local/go/src/runtime/cgo/asm_amd64.s:43
#39 0x00000000019af86a in go_frankenphp_on_thread_work (threadIndex=824640142696) at _cgo_export.c:299
#40 0x00000000019b1313 in php_thread (arg=<optimized out>) at frankenphp.c:826
#41 0x00007f3804e64144 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#42 0x00007f3804ee47dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Here's what all other threads are doing at the time of the crash if it helps:

1    Thread 0x7f3788df96c0 (LWP 128690) runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:154
  2    Thread 0x7f379affd6c0 (LWP 128679) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  3    Thread 0x7f379a24f6c0 (LWP 128680) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  4    Thread 0x7f376ffff6c0 (LWP 128713) 0x00007f38056c2435 in zend_optimize_temporary_variables (op_array=0x7f37454080f0, ctx=0x7f376fffd0d0)
    at /usr/local/src/php/Zend/Optimizer/optimize_temp_vars_5.c:131
  5    Thread 0x7f377affd6c0 (LWP 128700) lex_scan (zendlval=0x7f377affa370, elem=0x7f377affac80) at Zend/zend_language_scanner.l:3122
  6    Thread 0x7f37bab776c0 (LWP 128672) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  7    Thread 0x7f37ba3366c0 (LWP 128673) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  8    Thread 0x7f379bfff6c0 (LWP 128677) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  9    Thread 0x7f3777ff76c0 (LWP 128706) __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:280
  10   Thread 0x7f378bdff6c0 (LWP 128684) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  11   Thread 0x7f37b8aa36c0 (LWP 128676) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  12   Thread 0x7f378a5fc6c0 (LWP 128687) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  13   Thread 0x7f3776ff56c0 (LWP 128708) 0x00007f38056b1e16 in get_ssa_var_info (ssa=0x7f3745e7c630, ssa_var_num=1)
    at /usr/local/src/php/Zend/Optimizer/zend_inference.h:167
  14   Thread 0x7f3781ffb6c0 (LWP 128695) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  15   Thread 0x7f37797fa6c0 (LWP 128703) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  16   Thread 0x7f37837fe6c0 (LWP 128692) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  17   Thread 0x7f377a7fc6c0 (LWP 128701) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  18   Thread 0x7f3798a4c6c0 (LWP 128683) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  19   Thread 0x7f3789dfb6c0 (LWP 128688) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  20   Thread 0x7f378adfd6c0 (LWP 128686) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  21   Thread 0x7f3780ff96c0 (LWP 128697) 0x00007f38056c86c9 in zend_cfg_build_predecessors (arena=0x7f3780ff70d0, cfg=0x7f37474bf618)
    at /usr/local/src/php/Zend/Optimizer/zend_cfg.c:631
  22   Thread 0x7f380276d8c0 (LWP 128669) runtime/internal/syscall.Syscall6 () at /usr/local/go/src/runtime/internal/syscall/asm_linux_amd64.s:36   
  23   Thread 0x7f377b7fe6c0 (LWP 128699) zend_string_tolower_ex (str=0x7f36c8e52e60, persistent=false)
    at /usr/local/src/php/Zend/zend_operators.c:3093
  24   Thread 0x7f37b9b356c0 (LWP 128674) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  25   Thread 0x7f3799a4e6c0 (LWP 128681) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  26   Thread 0x7f3775ff36c0 (LWP 128710) zend_ssa_next_use (ssa_op=0x7f3745ad4620, var=47, use=66) at Zend/Optimizer/zend_ssa.h:196
  27   Thread 0x7f3782ffd6c0 (LWP 128693) __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
  28   Thread 0x7f37757f26c0 (LWP 128711) 0x00007f38056dce53 in zend_ssa_compute_use_def_chains (arena=0x7f37757f00d0, op_array=0x7f37458107d0,     
    ssa=0x7f37458aa470) at /usr/local/src/php/Zend/Optimizer/zend_ssa.c:1075
  29   Thread 0x7f37767f46c0 (LWP 128709) 0x00007f3805547820 in zend_mm_alloc_small (heap=0x7f3745c00040, bin_num=7,
    __zend_filename=0x7f3805fc35b0 "/usr/local/src/php/Zend/zend_string.h", __zend_lineno=174, __zend_orig_filename=0x0, __zend_orig_lineno=0)      
    at /usr/local/src/php/Zend/zend_alloc.c:1300
  30   Thread 0x7f3783fff6c0 (LWP 128691) lex_scan (zendlval=0x7f3783ffc370, elem=0x7f3783ffcc80)
    at /usr/local/src/php/Zend/zend_language_scanner.c:2312
  31   Thread 0x7f36d3fff6c0 (LWP 128720) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  32   Thread 0x7f3774ff16c0 (LWP 128712) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  33   Thread 0x7f37bb3786c0 (LWP 128671) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  34   Thread 0x7f379b7fe6c0 (LWP 128678) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  35   Thread 0x7f3778ff96c0 (LWP 128704) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  36   Thread 0x7f376effd6c0 (LWP 128715) lex_scan (zendlval=0x7f376effa370, elem=0x7f376effac80) at Zend/zend_language_scanner.l:2417
  37   Thread 0x7f376dffb6c0 (LWP 128717) 0x00007f3805547815 in zend_mm_alloc_small (heap=0x7f3744c00040, bin_num=26, __zend_filename=0x0,
    __zend_lineno=0, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /usr/local/src/php/Zend/zend_alloc.c:1300
  38   Thread 0x7f379924d6c0 (LWP 128682) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  39   Thread 0x7f37b92b46c0 (LWP 128675) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  40   Thread 0x7f376cff96c0 (LWP 128719) 0x00007f3805511b8a in lex_scan (zendlval=0x7f376cff6370, elem=0x7f376cff6c80)
    at /usr/local/src/php/Zend/zend_language_scanner.c:2584
  41   Thread 0x7f376f7fe6c0 (LWP 128714) 0x00007f38055baed5 in zif_function_exists (execute_data=0x7f3745214440, return_value=0x7f3745214430)      
    at /usr/local/src/php/Zend/zend_builtin_functions.c:1057
  42   Thread 0x7f378b5fe6c0 (LWP 128685) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  43   Thread 0x7f37895fa6c0 (LWP 128689) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  44   Thread 0x7f37827fc6c0 (LWP 128694) 0x00007f3805688df4 in zend_ast_is_list (ast=0x7f3747abffc8) at /usr/local/src/php/Zend/zend_ast.h:324     
  45   Thread 0x7f377bfff6c0 (LWP 128698) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  46   Thread 0x7f37bbb796c0 (LWP 128670) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  47   Thread 0x7f36d37fe6c0 (LWP 128721) runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:558
  48   Thread 0x7f37777f66c0 (LWP 128707) 0x00007f380558903d in _mm_set_epi8 (__q00=-102 '\232', __q01=-102 '\232', __q02=-102 '\232',
    __q03=-102 '\232', __q04=-102 '\232', __q05=-102 '\232', __q06=-102 '\232', __q07=-102 '\232', __q08=-102 '\232', __q09=-102 '\232',
    __q10=-102 '\232', __q11=-102 '\232', __q12=-102 '\232', __q13=-102 '\232', __q14=-102 '\232', __q15=-102 '\232')
    at /usr/lib/gcc/x86_64-linux-gnu/12/include/emmintrin.h:621
  49   Thread 0x7f376d7fa6c0 (LWP 128718) zend_mm_alloc_heap (heap=0x7f3780200040, size=96,
    __zend_filename=0x7f3805fc35b0 "/usr/local/src/php/Zend/zend_string.h", __zend_lineno=174, __zend_orig_filename=0x0, __zend_orig_lineno=0)      
    at /usr/local/src/php/Zend/zend_alloc.c:1392
  50   Thread 0x7f3779ffb6c0 (LWP 128702) 0x00007f3805715798 in dce_optimize_op_array (op_array=0x7f3746a0df50, optimizer_ctx=0x7f3779ff8a80,       
    ssa=0x7f3746abd488, reorder_dtor_effects=false) at /usr/local/src/php/Zend/Optimizer/dce.c:595
  51   Thread 0x7f37817fa6c0 (LWP 128696) 0x00007f3805547880 in zend_mm_alloc_small (heap=0x7f3747600040, bin_num=9,
    __zend_filename=0x7f3805fce7d0 "/usr/local/src/php/Zend/zend_string.h", __zend_lineno=174, __zend_orig_filename=0x0, __zend_orig_lineno=0)      
    at /usr/local/src/php/Zend/zend_alloc.c:1310
  52   Thread 0x7f37787f86c0 (LWP 128705) futex_wait (private=0, expected=2, futex_word=0x7f37901c7700) at ../sysdeps/nptl/futex-internal.h:146     
  53   Thread 0x7f376e7fc6c0 (LWP 128716) 0x00007f3804ed390a in __GI___close (fd=46) at ../sysdeps/unix/sysv/linux/close.c:27

The crash was reproduced by compiling PHP with debug symbols in the frankenphp-bookworm-zts Docker image with a clean Laravel and Laravel Octane installation, the crash happens sporadically on startup of the application (probably some kind of race condition).

PHP Version

8.3.15

Operating System

Debian bookworm ZTS Docker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions