chobie / php-uv

libuv php extension
184 stars 21 forks source link

seg fault #43

Closed xming closed 11 years ago

xming commented 11 years ago

I get seg fault with

<?php
$uv = uv_udp_init();
uv_udp_bind($uv, uv_ip4_addr('0.0.0.0',10000));

uv_udp_recv_start($uv, function($stream, $nread, $buffer) use ($uv) {
    echo "recv ($nread): " .  $buffer . "\n";
});

uv_udp_send($uv, pack("CxxxC", 0x78, 0x00), uv_ip4_addr("85.234.210.138", 7778), function($socket, $s) { });
uv_udp_send($uv, pack("CxxxC", 0x78, 0x00), uv_ip4_addr("85.234.210.138", 7778), function($socket, $s) { });

uv_run();
?>

here is the back trace

recv (107): �a*Titan�Internet�Freon�Server�xming's placeDM-MokumX-MatrixFreon
                                                                             0
recv (107): �a*Titan�Internet�Freon�Server�xming's placeDM-MokumX-MatrixFreon
                                                                             0

Program received signal SIGSEGV, Segmentation fault.
uv__set_sys_error (loop=0x0, sys_error=sys_error@entry=11) at src/uv-common.c:133
133       loop->last_err.sys_errno_ = sys_error;
(gdb) bt
#0  uv__set_sys_error (loop=0x0, sys_error=sys_error@entry=11) at src/uv-common.c:133
#1  0x00007ffff05c587e in uv__udp_recvmsg (loop=<optimized out>, w=0x7ffff7ff4e48, revents=<optimized out>)
    at src/unix/udp.c:237
#2  0x00007ffff05ca436 in ev_invoke_pending (loop=0x7ffff07f3160 <default_loop_struct>) at src/unix/ev/ev.c:2145
#3  0x00007ffff05be761 in uv__poll (loop=0x7ffff07f1600 <default_loop_struct>) at src/unix/core.c:248
#4  uv__run (loop=0x7ffff07f1600 <default_loop_struct>) at src/unix/core.c:257
#5  0x00007ffff05bea10 in uv_run (loop=0x7ffff07f1600 <default_loop_struct>) at src/unix/core.c:265
#6  0x00007ffff05ad731 in zif_uv_run () from /usr/src/xming/php-uv/modules/uv.so
#7  0x000000000081fc59 in ?? ()
#8  0x00000000007d480d in execute ()
#9  0x000000000076f2a2 in zend_execute_scripts ()
#10 0x0000000000704444 in php_execute_script ()
#11 0x0000000000822699 in ?? ()
#12 0x000000000047693f in main ()
xming commented 11 years ago

Ah this is same as issue #8, now how I know what error occurred in uv_udp_recv_start().

chobie commented 11 years ago

Thank you reporting issue. I reproduced problem.

recv (107): ?a*Titan?Internet?Freon?Server?xming's placeDM-MokumX-MatrixFreon
                                                                             0
recv (0): 

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00000001014369d6 in fd_event_nocheck (loop=0x101467ff8, fd=6, revents=1) at src/unix/ev/ev.c:943
943       int ev = w->events & revents;
(g

probably i missed some error handling. I'll check this problem in this weekend.

xming commented 11 years ago

Thanks a lot, I can confirm it's fixed.