Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何获取PHP文件和行号?_Php_Segmentation Fault_Pthreads_Php Pthread - Fatal编程技术网

如何获取PHP文件和行号?

如何获取PHP文件和行号?,php,segmentation-fault,pthreads,php-pthread,Php,Segmentation Fault,Pthreads,Php Pthread,我有一个大的应用程序,在多线程模式下运行-45个线程。 在某些情况下,应用程序会因分段错误而崩溃。我通过下一种方式使用gdb: ulimit -c unlimited sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t sleep 10 & killall -SIGSEGV sleep gdb /etc/php7/bin/php /tmp/core-sleep.4970.mike-Inspiron-N5040.15576481

我有一个大的应用程序,在多线程模式下运行-45个线程。 在某些情况下,应用程序会因
分段错误
而崩溃。我通过下一种方式使用gdb:

ulimit -c unlimited
sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
sleep 10 & killall -SIGSEGV sleep
gdb /etc/php7/bin/php /tmp/core-sleep.4970.mike-Inspiron-N5040.1557648122
run script.php
完整回溯是:

Thread 1 "php" received signal SIGSEGV, Segmentation fault.
pthreads_store_tohash (object=object@entry=0x7fffe9211b80,
    hash=0x7fffea78f188)
    at /var/www/interceptor.cmd.source/pthreads/src/store.c:564
564         ZEND_HASH_FOREACH_KEY_PTR(threaded->store.props, idx, name, storage) {
(gdb) bt
#0  pthreads_store_tohash (object=object@entry=0x7fffe9211b80,
    hash=0x7fffea78f188)
    at /var/www/interceptor.cmd.source/pthreads/src/store.c:564
#1  0x00007fffeac558d0 in pthreads_read_properties (object=0x7fffe9211b80)
    at /var/www/interceptor.cmd.source/pthreads/src/handlers.c:80
#2  0x000055555590769b in php_json_encode_array (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffe9211b80,
    options=options@entry=0, encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:139
#3  0x0000555555907020 in php_json_encode_zval (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffe9211b80,
    options=options@entry=0, encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#4  0x00005555559078b5 in php_json_encode_array (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffe9dada40,
    options=options@entry=0, encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:218
#5  0x0000555555907020 in php_json_encode_zval (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffe9dada40,
    options=options@entry=0, encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#6  0x00005555559078b5 in php_json_encode_array (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffec21eb90,
    options=options@entry=0, encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:218
#7  0x0000555555907020 in php_json_encode_zval (
    buf=buf@entry=0x7fffffffb730, val=val@entry=0x7fffec21eb90, options=0,
    encoder=encoder@entry=0x7fffffffb724)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#8  0x0000555555905570 in zif_json_encode (execute_data=0x7fffec21eb40,
    return_value=0x7fffec21eb20)
    at /var/www/interceptor/php-src-php-7.2.2/ext/json/json.c:245
#9  0x0000555555c41b13 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER ()
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:1032
#10 execute_ex (ex=0x7fffeab4e560)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#11 0x00007fffeac4ba15 in pthreads_execute_ex (data=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#12 0x0000555555c3fb5c in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#13 execute_ex (ex=0x7fffeab4e560)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#14 0x00007fffeac4ba15 in pthreads_execute_ex (data=<optimized out>)
    at /var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#15 0x0000555555c3fb5c in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#16 execute_ex (ex=0x7fffeab4e560)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#17 0x00007fffeac4ba15 in pthreads_execute_ex (data=<optimized out>)
    at /var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#18 0x0000555555c3fb5c in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#19 execute_ex (ex=0x7fffeab4e560)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#20 0x00007fffeac4ba15 in pthreads_execute_ex (data=<optimized out>)
    at /var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#21 0x0000555555c4265f in zend_execute (op_array=<optimized out>,
    return_value=0x0)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend_vm_execute.h:63760
#22 0x0000555555b852d2 in zend_execute_scripts (type=type@entry=8,
    retval=retval@entry=0x0, file_count=-333321568, file_count@entry=3)
    at /var/www/interceptor/php-src-php-7.2.2/Zend/zend.c:1496
#23 0x0000555555b1276e in php_execute_script (primary_file=0x7fffffffd020)
    at /var/www/interceptor/php-src-php-7.2.2/main/main.c:2590
#24 0x0000555555c44d73 in do_cli (argc=2, argv=0x55555674b7b0)
    at /var/www/interceptor/php-src-php-7.2.2/sapi/cli/php_cli.c:1011
#25 0x00005555556e3f31 in main (argc=2, argv=0x55555674b7b0)
    at /var/www/interceptor/php-src-php-7.2.2/sapi/cli/php_cli.c:1404
线程1“php”接收到信号SIGSEGV,分段错误。
pthreads\u store\u tohash(对象=object@entry=0x7fffe9211b80,
散列=0x7fffea78f188)
在/var/www/interceptor.cmd.source/pthreads/src/store.c:564
564 ZEND_HASH_FOREACH_KEY_PTR(线程->store.props,idx,name,storage){
(gdb)英国电信
#0 pthreads\u store\u tohash(对象=object@entry=0x7fffe9211b80,
散列=0x7fffea78f188)
在/var/www/interceptor.cmd.source/pthreads/src/store.c:564
#pthreads_read_属性中的1 0x00007fffeac558d0(对象=0x7fffe9211b80)
在/var/www/interceptor.cmd.source/pthreads/src/handlers.c:80
#php_json_encode_数组中的2 0x0000555555590769B(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffe9211b80,
选择权=options@entry=0,编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:139
#php_json_encode_zval中的3 0x00005555555907020(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffe9211b80,
选择权=options@entry=0,编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#php_json_encode_数组中的4 0x000055555559078b5(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffe9dada40,
选择权=options@entry=0,编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:218
#php_json_encode_zval中的5 0x00005555555907020(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffe9dada40,
选择权=options@entry=0,编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#php_json_encode_数组中的6 0x000055555559078b5(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffec21eb90,
选择权=options@entry=0,编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:218
#php_json_encode_zval中的7 0x00005555555907020(
buf=buf@entry=0x7FFFFFB730,val=val@entry=0x7fffec21eb90,选项=0,
编码器=encoder@entry=0x7FFFFFB724)
at/var/www/interceptor/php-src-php-7.2.2/ext/json/json_encoder.c:546
#8 zif_json_编码中的0x000055555905570(执行_数据=0x7fffec21eb40,
返回值(U值=0x7fffec21eb20)
在/var/www/interceptor/php-src-php-7.2.2/ext/json/json.c:245
#9 0x000055555C41B13在ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER()中
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:1032
#10执行(ex=0x7fffeab4e560)
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:59752
#pthreads_execute_ex中的11 0x00007fffeac4ba15(数据=)
---键入以继续,或键入q以退出---
在/var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#12 0x000055555C3FB5C在ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER()中
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:888
#13执行(ex=0x7fffeab4e560)
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:59749
#pthreads_execute_ex中的14 0x00007fffeac4ba15(数据=)
在/var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER()中的15 0x000055555C3FB5C
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:888
#16执行(ex=0x7fffeab4e560)
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:59749
#pthreads_execute_ex中的17 0x00007fffeac4ba15(数据=)
在/var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER()中的18 0x000055555C3FB5C
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:888
#19执行(ex=0x7fffeab4e560)
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:59749
#pthreads_execute_ex中的20 0x00007fffeac4ba15(数据=)
在/var/www/interceptor.cmd.source/pthreads/php_pthreads.c:135
#zend_执行中的21 0x000055555C4265F(op_数组=,
返回(值=0x0)
在/var/www/interceptor/php-src-php-7.2.2/Zend/Zend_vm_execute.h:63760
#zend_execute_脚本中的22 0x000055555B852D2(类型=type@entry=8,
复述=retval@entry=0x0,文件计数=-333321568,文件_count@entry=3)
位于/var/www/interceptor/php-src-php-7.2.2/Zend/Zend.c:1496
#23 php_执行_脚本中的0x000055555B1276E(主_文件=0x7FFFFFD020)
在/var/www/interceptor/php-src-php-7.2.2/main/main.c:2590
#do_cli中的24 0x000055555C44D73(argc=2,argv=0x555674B7B0)
在/var/www/interceptor/php-src-php-7.2.2/sapi/cli/php_cli.c:1011
#25 0x0000555556E3F31在主管道中(argc=2,argv=0x55555674b7b0)
在/var/www/interceptor/php-src-php-7.2.2/sapi/cli/php_cli.c:1404
所以可能错误在我的PHP代码中的某个地方。但我不知道它可能在哪里。我能知道发生分段错误的确切PHP文件和行吗

Xdebug我不能使用,因为它与一些扩展冲突。而且多线程模式对Xdebug来说可能是个问题

我的环境是:

Ubuntu服务器18.04 64位 PHP7.2.2ZTS无调试