expressif / pecl-event-libevent

PHP7 Libevent - event notification
http://pecl.php.net/package/libevent
56 stars 16 forks source link

_php_event_dtor makes segfault #2

Closed Joungkyun closed 8 years ago

Joungkyun commented 8 years ago

Hi, reports bug again.

OS: Centos 7.2 PHP: php-7.0.1

code:

<?php
$base = event_base_new ();
$e = event_new();
?>

expected: no result result: segfault

[root@an3 libevent]$ gdb php
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/php...(no debugging symbols found)...done.
(gdb) run a.php
Starting program: /bin/php a.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000739540 in zend_list_delete ()
Missing separate debuginfos, use: debuginfo-install php-cli-7.0.1-1.an3.x86_64
(gdb) bt
#0  0x0000000000739540 in zend_list_delete ()
#1  0x00007fffeb0d1b4d in _php_event_dtor (res=0x7fffffffcc50) at /root/rpmbuild/SOURCES/z/ext/libevent/libevent.c:174
#2  0x0000000000739341 in zend_resource_dtor ()
#3  0x00000000007393ca in list_entry_destructor ()
#4  0x0000000000735853 in zend_hash_index_del ()
#5  0x0000000000736733 in zend_hash_graceful_reverse_destroy ()
#6  0x0000000000715303 in shutdown_executor ()
#7  0x00000000007241da in zend_deactivate ()
#8  0x00000000006c3a31 in php_request_shutdown ()
#9  0x00000000007ab2c8 in do_cli ()
#10 0x0000000000440dcf in main ()
(gdb) f 1
#1  0x00007fffeb0d1b4d in _php_event_dtor (res=0x7fffffffcc50) at /root/rpmbuild/SOURCES/z/ext/libevent/libevent.c:174
174                     zend_list_delete(Z_RES_P(&event->stream_id));
(gdb) list
169             if (event->base) {
170                     base_id = event->base->rsrc_id;
171                     --event->base->events;
172             }
173             if (Z_TYPE_P(&event->stream_id) != IS_NULL) {
174                     zend_list_delete(Z_RES_P(&event->stream_id));
175             }
176             event_del(event->event);
177
178             _php_event_callback_free(event->callback);
(gdb)
ichiriac commented 8 years ago

fixed