chuan-yun / Molten

php probe for zipkin and opentracing
Apache License 2.0
793 stars 160 forks source link

Segmentation fault with PHP 7.2 #80

Closed dz0ny closed 6 years ago

dz0ny commented 6 years ago

Tests are also failing, but could not get any more info from them. So i made report with gdb...

Any ideas what could be the cause?

PHP:

PHP 7.2.3-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Mar  6 2018 12:03:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.3-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
root@roses:~/Molten/example# gdb php
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from php...(no debugging symbols found)...done.
(gdb) run -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:1");curl_exec($c);'
Starting program: /usr/bin/php -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:1");curl_exec($c);'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe7676700 (LWP 12846)]
[Thread 0x7fffe7676700 (LWP 12846) exited]
[{"traceId":"993eadb0d8dad3fa","name":"php_curl","version":"php-4","id":"9a62332b17f96ad3","parentId":"885500d93341be44","timestamp":1521723157392157,"duration":31502,"annotations":[{"value":"cs","timestamp":1521723157392157,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"value":"cr","timestamp":1521723157423659,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}],"binaryAnnotations":[{"key":"http.url","value":"http:\/\/localhost:1\/","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"key":"error","value":"Failed to connect to localhost port 1: Connection refused","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}]},{"traceId":"993eadb0d8dad3fa","name":"cli","version":"php-4","id":"885500d93341be44","timestamp":1521723157391992,"duration":31749,"annotations":[{"value":"sr","timestamp":1521723157391992,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"value":"ss","timestamp":1521723157423741,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}],"binaryAnnotations":[{"key":"path","value":"Standard input code","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}]}]

Program received signal SIGSEGV, Segmentation fault.
0x00005555557d5d50 in zend_function_dtor ()
(gdb) where
#0  0x00005555557d5d50 in zend_function_dtor ()
#1  0x00005555557f225b in zend_hash_str_del ()
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
#3  zm_shutdown_molten (type=<optimized out>, module_number=<optimized out>) at /root/Molten/molten.c:623
#4  0x00005555557e8433 in ?? ()
#5  0x00005555557e007c in ?? ()
#6  0x00005555557f3208 in zend_hash_graceful_reverse_destroy ()
#7  0x00005555557e1ace in ?? ()
#8  0x0000555555780a9b in php_module_shutdown ()
#9  0x00005555556420b5 in ?? ()
#10 0x00007ffff5fe5f45 in __libc_start_main (main=0x555555641d00, argc=13, argv=0x7fffffffe5c8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe5b8) at libc-start.c:287
#11 0x0000555555642273 in _start ()

Looks like https://github.com/chuan-yun/Molten/blob/master/molten.c#L216 tryies to restore overloaded function which is no longer there ....

13:18:35 INFO   /root/Molten/molten.c:585: molten start
13:18:35 INFO   /root/Molten/molten_log.c:31: [sink][http] http data sender, post_uri:
13:18:35 INFO   /root/Molten/molten_log.c:184: [sink] has libcurl
13:18:35 INFO   /root/Molten/molten_log.c:200: [sink] current select sink_type:4, input type4
13:18:35 INFO   /root/Molten/molten.c:656: molten request init
113:18:35 INFO   /root/Molten/molten.c:700: molten request shutdown
13:18:35 INFO   /root/Molten/molten_log.c:477: [sink] mo log flush 
13:18:35 INFO   /root/Molten/molten_log.c:526: [sink] mo log flush detail size:473
13:18:35 INFO   /root/Molten/molten_log.c:428: [sink] mo log write sink_type [4]
13:18:35 INFO   /root/Molten/molten_log.c:31: [sink][http] http data sender, post_uri:http://127.0.0.1:9411/api/v1/spans
13:18:35 INFO   /root/Molten/molten_log.c:47:  curl request code:0
Segmentation fault (core dumped)
(gdb) bt
#0  0x00005555557d5d50 in zend_function_dtor ()
#1  0x00005555557f225b in zend_hash_str_del ()
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
#3  zm_shutdown_molten (type=<optimized out>, module_number=<optimized out>) at /root/Molten/molten.c:623
#4  0x00005555557e8433 in ?? ()
#5  0x00005555557e007c in ?? ()
#6  0x00005555557f3208 in zend_hash_graceful_reverse_destroy ()
#7  0x00005555557e1ace in ?? ()
#8  0x0000555555780a9b in php_module_shutdown ()
#9  0x00005555556420b5 in ?? ()
#10 0x00007ffff5fe5f45 in __libc_start_main (main=0x555555641d00, argc=17, argv=0x7fffffffe578, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe568) at libc-start.c:287
(gdb) frame 2
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
234               zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func)); 
(gdb) print p
$1 = (const mo_reload_def *) 0x7fffe5ddb530 <prd+48>
(gdb) print p->save_func
$3 = 0x7fffe5bd7578 "origin_molten_curl_setopt_array"
(gdb) print p->orig_func
$4 = 0x7fffe5bd74e9 "curl_setopt_array"
(gdb) print p->over_func
$5 = 0x7fffe5bd74e2 "molten_curl_setopt_array"
silkcutKs commented 6 years ago

@dz0ny now current version not support php 7.2.

silkcutKs commented 6 years ago

master version support php 7.2 now.

silkcutKs commented 6 years ago

resolved

tanxiaolong commented 6 years ago

php 7.2.6 is not supported. still "Segmentation fault (core dumped)" .@silkcutKs

geyang0101 commented 6 years ago

Hope Molten extension can support php 7.2.11 @silkcutKs