在php-fpm下,服务器间歇出现core dump 追踪到php代码是include一个php文件

发布于 2022-09-01 17:52:00 字数 4393 浏览 14 评论 0

服务器在间歇性的出现core dump;
于是有一下操作;

gdb php-fpm -c core.10508

balabalabala
(gdb) bt
#0  0x00000000005d27f8 in _zend_mm_free_int (heap=0x23bc300, p=0x26cdb20) at /root/php-5.3.27/Zend/zend_alloc.c:2028
#1  0x00000000005d367f in _efree (ptr=0x26cdb20) at /root/php-5.3.27/Zend/zend_alloc.c:2361
#2  0x00000000005b3163 in zend_multibyte_read_script (buf=0x7f80240cd000 <Address 0x7f80240cd000 out of bounds>, n=32525) at Zend/zend_language_scanner.l:709
#3  0x00000000005b1f54 in open_file_for_scanning (file_handle=0x7fff4efc6470) at Zend/zend_language_scanner.l:279
#4  0x00000000005b2246 in compile_file (file_handle=0x7fff4efc6470, type=8) at Zend/zend_language_scanner.l:352
#5  0x00007f802c3e321f in my_compile_file (h=0x7fff4efc6470, type=8) at /root/APC-3.1.9/apc_main.c:543
#6  0x00007f80305b8b7f in phar_compile_file (file_handle=0x7fff4efc6470, type=8) at /root/php-5.3.27/ext/phar/phar.c:3394
#7  0x00000000005b2457 in compile_filename (type=8, filename=0x2993a30) at Zend/zend_language_scanner.l:407
#8  0x00000000006b3bbd in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x27defa0) at /root/php-5.3.27/Zend/zend_vm_execute.h:22537
#9  0x000000000062d686 in execute (op_array=0x274b150) at /root/php-5.3.27/Zend/zend_vm_execute.h:107
#10 0x00000000005e9cb4 in zend_call_function (fci=0x7fff4efc68e0, fci_cache=0x7fff4efc68b0) at /root/php-5.3.27/Zend/zend_execute_API.c:967
#11 0x00000000004a9bb1 in zim_reflection_method_invoke (ht=1, return_value=0x2734b38, return_value_ptr=0x0, this_ptr=0x2731730, return_value_used=0) at /root/php-5.3.27/ext/reflection/php_reflection.c:2636
#12 0x000000000062e289 in zend_do_fcall_common_helper_SPEC (execute_data=0x27d90b0) at /root/php-5.3.27/Zend/zend_vm_execute.h:322
#13 0x000000000062e9b9 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x27d90b0) at /root/php-5.3.27/Zend/zend_vm_execute.h:430
#14 0x000000000062d686 in execute (op_array=0x2969580) at /root/php-5.3.27/Zend/zend_vm_execute.h:107
#15 0x00000000005f98aa in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/php-5.3.27/Zend/zend.c:1259
#16 0x000000000058056c in php_execute_script (primary_file=0x7fff4efcb080) at /root/php-5.3.27/main/main.c:2316
#17 0x00000000006ed0ba in main (argc=2, argv=0x7fff4efcb2a8) at /root/php-5.3.27/sapi/fpm/fpm/fpm_main.c:1929

(gdb)  zbacktrace
[0x027defa0] require_cache() /webroot/Runtime/~runtime.php:1 
[0x027de320] require_cache() /webroot/Runtime/~runtime.php:1 
[0x027dd450] import() /webroot/Runtime/~runtime.php:1 
[0x027dd298] D() /webroot/Lib/Common/Goods/GoodsLogic.class.php:42 
[0x027dc9c0] getDataModel() /webroot/Lib/Common/Goods/GoodsLogic.class.php:256 
[0x027dbc08] goodsNeedRef() /webroot/Lib/Action/Web/InterfacegoodAction.class.php:80 
[0x027dbb18] pcgoodMongo() /webroot/Lib/Action/Web/InterfacegoodAction.class.php:29 
[0x027da720] pcgood_mongo() /webroot/Lib/Action/Web/InterfacegoodAction.class.php:134 
[0x4efc66f0] pcgood() 
[0x027d90b0] invoke() /webroot/~runtime.php:1 
[0x027d8ed0] exec() /webroot/~runtime.php:1 
[0x027d8cc8] run() /webroot/~runtime.php:1 
[0x027d6e98] start() /webroot/~runtime.php:7 
[0x027d63f8] ??? /webroot/ThinkPHP/ThinkPHP.php:31 
[0x027d6040] ??? /webroot/index.php:22 
(gdb)  print_cvs 2
Compiled variables count: 2
0 = filename
[0x02993a30] (refcount=3) string(74): "/webroot/Lib/Model/MongoGoodsModel.class.php"
1 = _importFiles
[0x027c9890] (refcount=2,is_ref) array(8): {
    "/webroot/Lib/Action/Web/InterfaceAction.class.php\0" => [0x0273db08] (refcount=1) bool: true
    "/webroot/Lib/Action/Web/InterfacegoodAction.class.php\0" => [0x027378a8] (refcount=1) bool: true
    "/webroot/ThinkPHP/Lib/Core/Model.class.php\0" => [0x028622f0] (refcount=1) bool: true
    "/webroot/Lib/Model/UserModel.class.php\0" => [0x026f6140] (refcount=1) bool: true
    "/webroot/ThinkPHP/Lib/Core/Db.class.php\0" => [0x02880e48] (refcount=1) bool: true
    "/webroot/ThinkPHP/Extend/Driver/Db/DbMysql.class.php\0" => [0x02882928] (refcount=1) bool: false
    "/webroot/ThinkPHP/Lib/Driver/Db/DbMysql.class.php\0" => [0x0288d360] (refcount=1) bool: true
    "/webroot/Lib/Common/Goods/GoodsLogic.class.php\0" => [0x029905c0] (refcount=1) bool: true
  }
1 = _importFiles
Structure has no component named operator!=.

同类型的core很多 最终都能定位到include~~~~~
会不会是php-fpm 的内存出现了问题
php 5.3.27
apc 3.1.9

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

宁愿没拥抱 2022-09-08 17:52:00

看上去是APC这个加速扩展引起的问题,关掉APC应该就没事了.

风吹过旳痕迹 2022-09-08 17:52:00

请教一下怎么为php-fpm生成core dump?
我用ulimit -c unlimited,只能为当前用户的session窗口设置,关闭了再登录,又没了。
我查了一下,说是修改/etc/security/limits.conf,但是要重启。
也可以修改/etc/profile,但是应该只对登录用户有效吧。我是用nobody跑php-fpm的。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文