本邮件内容由第三方提供,如果您不想继续收到该邮件,可 点此退订 。
GDB分析PHP连接Memcached 导致coredump问题 阅读原文»
用户名:gavindev 文章数:23 评论数:1
访问量:2081:261:234:2 注册日期:2010-10-23
最近一项目压力比较大,502超多,PHP进程coredump比较频繁
于是学习了下coredump的调试
讲下PHP coredump的调试,coredump先准备代码比较好,因为PHP是开源的,这点好办。我的是存在/usr/local/src//usr/local/src/php-5.3.10/ 下
第一种当然是通用的调试
gdb /usr/local/php/sbin/php-fpm -c /data/core_files/core-php-fpm- 28436 - 1370008094 |
第二种是PHP特有的调试
获得一个PHP正在运行的进程
#ps -ef|grep php-fpm|head #gdb --pid=$PID >source /usr/local/src //usr/local/src/php-5.3.10/.gdbinit |
这种方式能调试一些PHP特有的东西,比如包括参数的函数调用栈的信息.
#0 0x00007ffed0603a75 in raise () from /lib/libc.so.6 #1 0x00007ffed06075c0 in abort () from /lib/libc.so.6 #2 0x00007ffed342ef7c in memcached_io_slurp (ptr=0x2ef9f50) at libmemcached/io.cc:510 #3 0x00007ffed3431da6 in memcached_quit_server (ptr=0x2ef9f50, io_death=false) at libmemcached/quit.cc:95 #4 0x00007ffed3431eed in send_quit (ptr=0x2d34e90) at libmemcached/quit.cc:137 #5 0x00007ffed342ff39 in _free (ptr=0x2d34e90, release_st=true) at libmemcached/memcached.cc:130 #6 0x00007ffed3430397 in memcached_free (ptr=0x2d34e90) at libmemcached/memcached.cc:284 #7 0x00000000005d00e0 in php_memc_destroy (m_obj=0x2e3bf60, persistent=0 '\000') at /usr/local/src/php-5.3.10/ext/memcached/php_memcached.c:2519 #8 0x00000000005d145f in php_memc_free_storage (i_obj=0x2dea580) at /usr/local/src/php-5.3.10/ext/memcached/php_memcached.c:2530 #9 0x000000000081817a in zend_objects_store_del_ref_by_handle_ex (handle=<value optimized out>, handlers=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_objects_API.c:220 #10 0x0000000000818193 in zend_objects_store_del_ref (zobject=0x2dea620) at /usr/local/src/php-5.3.10/Zend/zend_objects_API.c:172 #11 0x00000000007e9fb5 in _zval_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_variables.h:35 #12 _zval_ptr_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_execute_API.c:447 #13 0x00000000008020eb in zend_hash_destroy (ht=0x2d21e20) at /usr/local/src/php-5.3.10/Zend/zend_hash.c:529 #14 0x00000000007f5416 in _zval_dtor_func (zvalue=0x2d21df0) at /usr/local/src/php-5.3.10/Zend/zend_variables.c:43 #15 0x00000000007e9fb5 in _zval_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_variables.h:35 #16 _zval_ptr_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_execute_API.c:447 #17 0x00000000008023f3 in zend_hash_clean (ht=0x2d21cb0) at /usr/local/src/php-5.3.10/Zend/zend_hash.c:561 #18 0x00000000007ee2cb in zend_cleanup_op_array_data (function=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_opcode.c:133 #19 zend_cleanup_function_data (function=<value optimized out>) at /usr/local/src/php-5.3.10/Zend/zend_opcode.c:140 #20 0x0000000000801ea4 in zend_hash_reverse_apply (ht=0x29e5c30, apply_func=0x7ee2a0 <zend_cleanup_function_data>) at /usr/local/src/php-5.3.10/Zend/zend_hash.c:757 #21 0x00000000007ea2f3 in shutdown_executor () at /usr/local/src/php-5.3.10/Zend/zend_execute_API.c:296 #22 0x00000000007f6563 in zend_deactivate () at /usr/local/src/php-5.3.10/Zend/zend.c:891 #23 0x00000000007a47a0 in php_request_shutdown (dummy=<value optimized out>) at /usr/local/src/php-5.3.10/main/main.c:1661 #24 0x0000000000884442 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/local/src/php-5.3.10/sapi/fpm/fpm/fpm_main.c:1886 #2 0x00007ffed342ef7c in memcached_io_slurp (ptr=0x2ef9f50) at libmemcached/io.cc:510 510 libmemcached/io.cc: No such file or directory. in libmemcached/io.cc |
为了调试memcached,会碰到了提示说 libmemcached/io.cc不存在,于是也把libmemcached的源码也下载回来。
注意版本得配对,否则容易造成找代码行数找不准,就白瞎了。
warning: Source file is more recent than executable. |
看版本用 -i来看
订阅:
博文评论 (Atom)
|
没有评论:
发表评论