Issues with Socket.accept() and SIGUSR1
LeqxLeqx
mitchelldlarson at protonmail.ch
Fri Dec 8 22:27:41 UTC 2017
Hello,
I've been trying to create a small server-client program, and
I've run into a rather strange problem. There's a thread separate
from the main which accepts incoming connections. The established
connections are then passed over to the main thread for the
actual logic of the interaction, and the accept thread loops back
to listen for further connections.
Normally the accept will throw a timeout and then the loop will
continue to listen, but sometimes (and I can't find a decent
pattern) the Socket.accept() method will raise a SIGUSR1 rather
than throwing an exception of any kind.
Can anyone help with this? I have no idea why this happen. Below
is the output from GDB when I've been testing it.
Thread 2 "sverse" received signal SIGUSR1, User defined signal
1.
[Switching to Thread 0x7ffff6a16700 (LWP 1562)]
0x00007ffff72a5840 in __libc_accept (fd=3, addr=addr at entry=...,
len=len at entry=0x0) at ../sysdeps/unix/sysv/linux/accept.c:26
26 ../sysdeps/unix/sysv/linux/accept.c: No such file or
directory.
(gdb) backtrace
#0 0x00007ffff72a5840 in __libc_accept (fd=3,
addr=addr at entry=..., len=len at entry=0x0) at
../sysdeps/unix/sysv/linux/accept.c:26
#1 0x00005555555be5d5 in std.socket.Socket.accept()
(this=0x7ffff7edc0e0) at
../../../../src/libphobos/src/std/socket.d:2817
#2 0x00005555555801c1 in
sverse.server.server.Server.acceptCallback()
(this=0x7ffff7eda100) at ./sverse/server/server.d:264
#3 0x00005555555fa842 in core.thread.Thread.run()
(this=0x7ffff7eda200) at
../../../../src/libphobos/libdruntime/core/thread.d:1403
#4 thread_entryPoint (arg=0x7ffff7eda200) at
../../../../src/libphobos/libdruntime/core/thread.d:392
#5 0x00007ffff6c227fc in start_thread (arg=0x7ffff6a16700) at
pthread_create.c:465
#6 0x00007ffff72a4b0f in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) info locals
resultvar = 18446744073709551612
sc_cancel_oldtype = 0
(gdb) up
#1 0x00005555555be5d5 in std.socket.Socket.accept()
(this=0x7ffff7edc0e0) at
../../../../src/libphobos/src/std/socket.d:2817
2817 ../../../../src/libphobos/src/std/socket.d: No such file
or directory.
(gdb) info locals
newSocket = <optimized out>
newsock = <optimized out>
Using GDC if that helps.
Any and all assistance will be greatly appreciated
Thanks,
More information about the Digitalmars-d
mailing list