Linux下,Apache及PHP项目报Core错误Program terminated with signal 7, Bus error

    最近上线的一个项目,使用Apache 2.2.32及ThinkPHP3.23,每天访问量共有几万吧,但会出现几十次错误,表现就是Apache根目录下,会出现Core.XXXXX的文件,同时错误日志内会显示:[Thu Nov 30 09:06:04 2017] [notice] child pid 11507 exit signal Bus error (7), possible coredump in /www/bin2/apache

Linux下,Apache及PHP项目报Core错误Program terminated with signal 7, Bus error_第1张图片

   网上搜索,发现一个帖子,差不多是同样的错误 https://bugs.php.net/bug.php?id=52752

  用gdb ./bin/httpd Core.XXXX进行查错显示,打开后,输入 bt,

#0  lex_scan (zendlval=0x7fff0ba3c140) at Zend/zend_language_scanner.c:2037
#1  0x00007fde1da5dbf1 in zendlex (elem=0x7fff0ba3cb20) at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_compile.c:1701
#2  0x00007fde1da4006a in zendparse () at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_language_parser.c:4450
#3  0x00007fde1da4309b in zend_compile (type=2) at Zend/zend_language_scanner.l:585
#4  0x00007fde1da4477b in compile_file (file_handle=0x7fff0ba3cf00, type=2) at Zend/zend_language_scanner.l:635
#5  0x00007fde1d8d585f in phar_compile_file (file_handle=0x7fff0ba3cf00, type=2)
    at /home/cdlonger/setupfile/php-7.1.3/ext/phar/phar.c:3320
#6  0x00007fde1da43ebf in compile_filename (type=2, filename=0x7fde16616a20) at Zend/zend_language_scanner.l:662
#7  0x00007fde1db1533a in zend_include_or_eval (inc_filename=0x7fde16616a20, type=2)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_execute.c:2846
#8  0x00007fde1db1543d in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7fde166169d0)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:35461
#9  0x00007fde1dad7ee8 in execute_ex (ex=)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:432
#10 0x00007fde1da6e0c0 in zend_call_function (fci=0x7fff0ba3d1d0, fci_cache=0x7fff0ba3d210)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_execute_API.c:846
#11 0x00007fde1d97869c in zif_call_user_func_array (execute_data=0x7fde16616960, return_value=0x7fde16616910)
    at /home/cdlonger/setupfile/php-7.1.3/ext/standard/basic_functions.c:4853
#12 0x00007fde1daf8197 in ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_HANDLER (execute_data=0x7fde16616860)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:876
#13 0x00007fde1dad7ee8 in execute_ex (ex=)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:432
#14 0x00007fde1da6e0c0 in zend_call_function (fci=0x7fff0ba3d3f0, fci_cache=0x7fff0ba3d430)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_execute_API.c:846
#15 0x00007fde1d8f1f7f in reflection_method_invoke (execute_data=, return_value=0x7fff0ba3d4e0, 
    variadic=1) at /home/cdlonger/setupfile/php-7.1.3/ext/reflection/php_reflection.c:3325
#16 0x00007fde1daf93b0 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (execute_data=0x7fde16612b90)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:970
#17 0x00007fde1dad7ee8 in execute_ex (ex=)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:432
#18 0x00007fde1db23920 in zend_execute (op_array=0x7fde16679000, return_value=)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend_vm_execute.h:474
#19 0x00007fde1da7c753 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /home/cdlonger/setupfile/php-7.1.3/Zend/zend.c:1476
#20 0x00007fde1da1c060 in php_execute_script (primary_file=0x7fff0ba3f940)
    at /home/cdlonger/setupfile/php-7.1.3/main/main.c:2537
#21 0x00007fde1db26915 in php_handler (r=0x1d250e0)
    at /home/cdlonger/setupfile/php-7.1.3/sapi/apache2handler/sapi_apache2.c:757
#22 0x000000000043b4c0 in ap_run_handler (r=0x1d250e0) at config.c:158
#23 0x000000000043eaee in ap_invoke_handler (r=0x1d250e0) at config.c:376
#24 0x000000000045a5f0 in ap_process_request (r=0x1d250e0) at http_request.c:298
---Type to continue, or q to quit---
#25 0x0000000000457550 in ap_process_http_connection (c=0x1d19270) at http_core.c:190
#26 0x0000000000442a60 in ap_run_process_connection (c=0x1d19270) at connection.c:43
#27 0x0000000000476458 in child_main (child_num_arg=) at prefork.c:667
#28 0x0000000000476754 in make_child (s=0x1ab5d98, slot=33) at prefork.c:768
#29 0x00000000004773a7 in perform_idle_server_maintenance (_pconf=, plog=
    s=) at prefork.c:903
#30 ap_mpm_run (_pconf=, plog=, s=) at prefork.c:1107
#31 0x0000000000426644 in main (argc=3, argv=0x7fff0ba3ff28) at main.c:753

大概意思就是进行php文件编译处理的时候,文件又被别的地方修改了,所以引起了冲突,参考那个帖子里面的操作,

[2017-06-09 19:28 UTC] [email protected]
It seems to be over-allocating on the stack.
Let's see if we can narrow the problem down to finding the file that's causing the problem.


In gbd, jump to frame 5 and print file_handle as well as file_handle as well as file_handle->filename and file_handle->opened_path


(gdb) f 5
(gdb) p file_handle
(gdb) p file_handle->filename
(gdb) p file_handle->opened_path

(gdb) p file_handle.filename
$3 = 0x7fde16424738 "./App/Runtime/Cache/Home/1e0959ec826efaa806577e175cf856b6.php"
我发现是thinkphp目录下的缓存文件,当时系统内设置的是开启DEBUG,TMPL_CACHE_ON=> false,HTML_CACHE_ON=> false,
就意味着每次打开那个页面,都会去重新生成缓存,如果刚好有并发的情况下,可能就冲突了,所以在配置文件内,修改为
APP_DEBUG => false,TMPL_CACHE_ON=>true,HTML_CACHE_ON=> true,这样,只有当php文件被修改时,才会去重新生成缓存,减少了冲突机率。

你可能感兴趣的:(网站开发)