-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Description
When compiled with -threaded, the following program crashes with the message: threadWait: invalid argument (Bad file descriptor). This happens with network-3.0.1.1 and with HEAD, but not with network-2.6.3.6.
import Network.Socket
main :: IO ()
main = do
sock <- socket AF_INET Stream defaultProtocol
setSocketOption sock ReuseAddr 1
bind sock $ SockAddrInet 6000 $ tupleToHostAddress (127, 0, 0, 1)
listen sock 1
_ <- accept sock
return ()This seems to be caused by the fact that the accept function doesn't ensure that the internal IORef inside the socket remains referenced until the accept operation is complete. The solution would be to implement something like #352 and use it in every function that might block, like accept or recvBuf.
Metadata
Metadata
Assignees
Labels
No labels