mkoppanen/php-zmq — Issue #49: Segmentation fault: 11
Author: dark9
Created: 2012-02-11 03:17:52+00:00
State: open

------------------------------------php script-----------------------------------------
bind('inproc://test');

$client=new ZMQSocket($context, ZMQ::SOCKET_REQ);
$client->connect('inproc://test');

$poll=new ZMQPoll();
$poll->add($server, ZMQ::POLL_IN);
$poll->add($client, ZMQ::POLL_IN);

for($i=0;$i<10;$i++)
{
$readable = array();
$writable = array();

if($i%2)
{
$server->send($i);
}
else
{
$client->send($i);
}

$event=$poll->poll($readable, $writable);

if(!$event)
{
continue;
}

foreach ($readable as $socket)
{
$msg=$socket->recv();

if($socket===$server)
{
echo 'client to server msg:'.$msg.PHP_EOL;
}
else
{
echo 'server to client msg:'.$msg.PHP_EOL;
}
}
}
?>
------------------------------------php script-----------------------------------------

------------------------------------php result-----------------------------------------
client to server msg:0
server to client msg:1
client to server msg:2
server to client msg:3
client to server msg:4
server to client msg:5
client to server msg:6
server to client msg:7
client to server msg:8
server to client msg:9
Segmentation fault: 11
------------------------------------php result-----------------------------------------

------------------------------------php info-----------------------------------------
PHP Version => 5.3.10

System => Darwin localhost 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
Build Date => Feb 10 2012 14:47:34
Configure Command => './configure' '--prefix=/usr' '--disable-all' '--enable-cli' '--with-curl' '--with-zmq' '--enable-json' '--enable-memcached' '--disable-memcached-session' '--disable-cgi' '--with-rune' '--disable-ipv6' '--with-zlib-dir=/opt/local'
Server API => Command Line Interface
------------------------------------php info-----------------------------------------

------------------------------------gdb bt-----------------------------------------
#0 0x0000000100181845 in zend_objects_store_del_ref_by_handle_ex (handle=6388696, handlers=0x1002f6ea0) at zend_objects_API.c:196
#1 0x0000000100181a5a in zend_objects_store_del_ref (zobject=0x100615ce8) at zend_objects_API.c:173
#2 0x000000010010ab78 in php_zmq_socket_object_free_storage (object=0x617bd8) at zmq.c:1470
#3 0x00000001001819a1 in zend_objects_store_del_ref_by_handle_ex (handle=6388696, handlers=0x1002f6ea0) at zend_objects_API.c:220
#4 0x0000000100181a5a in zend_objects_store_del_ref (zobject=0x100617c18) at zend_objects_API.c:173
#5 0x000000010015619a in _zval_dtor [inlined] () at /Users/dark9/Downloads/php-5.3.10/Zend/zend_variables.h:35
#6 0x000000010015619a in _zval_ptr_dtor (zval_ptr=0x617bd8) at zend_variables.h:447
#7 0x000000010016d3d4 in zend_hash_apply_deleter (ht=0x1002e45c8, p=0x1006182b8) at zend_hash.c:612
#8 0x000000010016d608 in zend_hash_graceful_reverse_destroy (ht=0x617bd8) at zend_hash.c:647
#9 0x00000001001589fb in shutdown_executor () at zend_execute_API.c:256
#10 0x0000000100161f63 in zend_deactivate () at zend.c:891
#11 0x0000000100110539 in php_request_shutdown (dummy=0x617bd8) at main.c:1661
#12 0x00000001001dc653 in main (argc=1606417440, argv=0x7fff5fbffc20) at php_cli.c:1363
------------------------------------gdb bt-----------------------------------------