kcp icon indicating copy to clipboard operation
kcp copied to clipboard

segment->xmit Cannot access memory at address

Open everett-moon opened this issue 2 years ago • 1 comments

Sometime ikcp_flush() raise segmentation fault. Below is back trace.

Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000562b87393905 in ikcp_flush (kcp=0x7f2fbc4f5d30) at ikcp.c:1052 1052 if (segment->xmit == 0) { [Current thread is 1 (Thread 0x7f2fc53b6700 (LWP 98941))] (gdb) bt #0 0x0000562b87393905 in ikcp_flush (kcp=0x7f2fbc4f5d30) at ikcp.c:1052 #1 0x0000562b87393e24 in ikcp_update (kcp=0x7f2fbc4f5d30, current=3585797370) at ikcp.c:1169 #2 0x0000562b8738bca7 in media_transport_kcp_update (tp=0x7f2fbc000c08) at transport_ice.c:1740 #3 0x0000562b8738333a in micro_worker_proc (arg=0x7f2fb8000c08) at microhttpd.c:2274 #4 0x0000562b873b8b10 in thread_main () #5 0x00007f2fc82b5ea7 in start_thread (arg=) at pthread_create.c:477 #6 0x00007f2fc8130def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) f 0 #0 0x0000562b87393905 in ikcp_flush (kcp=0x7f2fbc4f5d30) at ikcp.c:1052 1052 if (segment->xmit == 0) { (gdb) p segment $1 = (IKCPSEG *) 0x816adc6ae38a6a89 (gdb) p segment->xmit Cannot access memory at address 0x816adc6ae38a6ac5

everett-moon avatar Dec 20 '21 02:12 everett-moon

It seems that KCP object is not thread-safe, thus I have add a mutex lock to protect it.

everett-moon avatar Dec 20 '21 02:12 everett-moon