... before passing them to FD_ISSET.
From a quick look at the issue, I'd say it is a bug in Socket::select(). When you close a socket, the socket object's file descriptor for the socket is set to POCO_INVALID_SOCKET. This causes the FD_ISSET to crash. Proper fix would be to check the descriptor for POCO_INVALID_SOCKET before passing it to FD_ISSET in Socket::select(). The reason why it probably works with TCP sockets is that a TCP socket needs more time to close, as there's some communication involved, whereas UDP sockets are closed immediately.
I'm having a problem with a SIGSEGV in Socket::select() when closing a
DatagramSocket. The socket has a ReadableNotification and
ShutdownNotification registered with a SocketReactor.
What I think happens is that when I destroy the DatagramSocket, the reactor
is likely to be still in the select call. In the meantime, the socket is
removed. When the system select() returns, it crashes in the code below,
probably because it is accessing a dead socket.
for (SocketList::const_iterator it = readList.begin(); it !=
if (FD_ISSET(it->sockfd(), &fdRead)) <-- crash here
Since I haven't seen this happen with my StreamSockets, I'm possibly
completely on the wrong track :)
Can anyone tell me how to properly close a DatagramSocket when it's used in