Found Segmentation fault when trying to serialize instance of EventHttpRequest

Issue #40 closed
Timandes White
created an issue

Backtrace:

(gdb) bt
#0  0x0000000000704d90 in zend_array_count ()
#1  0x0000000000674c3c in php_var_serialize_intern ()
#2  0x000000000067531c in php_var_serialize ()
#3  0x00000000006753d8 in zif_serialize ()
#4  0x00007f08f72be8af in xdebug_execute_internal () from /usr/local/php-7.0/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
#5  0x000000000076fe32 in ZEND_DO_FCALL_SPEC_HANDLER ()
#6  0x0000000000737b00 in execute_ex ()
#7  0x00007f08f72bee87 in xdebug_execute_ex () from /usr/local/php-7.0/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
#8  0x00000000006eb4d5 in zend_call_function ()
#9  0x00007f08f5c6041b in _http_callback (req=<value optimized out>, arg=0x7f08fd686000) at /home/v-yanan/rpmbuild/BUILD/event-2.2.1/php7/classes/http.c:105
#10 0x00007f08f582e4bf in ?? () from /usr/local/libevent-2.0.21/lib/libevent_extra-2.0.so.5
#11 0x00007f08f582deb3 in ?? () from /usr/local/libevent-2.0.21/lib/libevent_extra-2.0.so.5
#12 0x00007f08f560d855 in ?? () from /usr/local/libevent-2.0.21/lib/libevent_core-2.0.so.5
#13 0x00007f08f560577c in event_base_loop () from /usr/local/libevent-2.0.21/lib/libevent_core-2.0.so.5
#14 0x00007f08f5c5a0f8 in zim_EventBase_dispatch (execute_data=<value optimized out>, return_value=0x7f08fd6140c0) at /home/v-yanan/rpmbuild/BUILD/event-2.2.1/php7/classes/base.c:172
#15 0x00007f08f72be8af in xdebug_execute_internal () from /usr/local/php-7.0/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
#16 0x000000000076fe32 in ZEND_DO_FCALL_SPEC_HANDLER ()
#17 0x0000000000737b00 in execute_ex ()
#18 0x00007f08f72bee87 in xdebug_execute_ex () from /usr/local/php-7.0/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
#19 0x000000000078b1cb in zend_execute ()
#20 0x00000000006f83b3 in zend_execute_scripts ()
#21 0x000000000069b240 in php_execute_script ()
#22 0x000000000078f54a in do_cli ()
#23 0x000000000078fd4a in main ()

Comments (4)

  1. Ruslan Osmanov repo owner

    Fixed #40. Introduced EventException

    Fixed issue #40: Segmentation fault when trying to serialize instance of EventHttpRequest

    EventException will be thrown when the user tries to serialize or unserialize an instance of EventBase, EventHttp, EventHttpRequest, EventHttpConnection, or EventConfig

    → <<cset ab8cf5b77815>>

  2. Ruslan Osmanov repo owner

    It is very difficult (if even possible) to save and restore the state of the underlying Libevent structures. Here is a good explanation of the problem. So the classes of this extension do not support serialization.

    As mentioned in the Git comment, from now on EventException will be thrown when the user tries to serialize/unserialize an instance of EventBase, EventHttp, EventHttpRequest, EventHttpConnection, or EventConfig. The rest of Event objects may be serialized without segmentation fault. However, you shouldn't serialize these objects directly. If you really need to serialize Event* objects, I recommend implementing Serializable interface in your own class (save instance data in the serialize method; create new instance using the saved data in the unserialize method).

  3. Log in to comment