Peek through recently network's code, the new IORef CInt based Socket seems to still have previous discussed fd-reuse race condiftion:
-
Thread A acquires a Socket 's fd by fdSocket, when it's about to do some operations, the scheduler decide to pause thread A.
-
Thread B close the socket, rewrite the Socket 's IORef 's content.
-
Thread C open a new socket, unfortunately got the same fd number thread A is holding now.
-
When thread A is resumed, it's unaware of thread B and thread C 's behavior, thus the following operations will performed successfully, but on a wrong fd.
Maybe it's necessary to add some docs on close ?
Peek through recently network's code, the new
IORef CIntbasedSocketseems to still have previous discussed fd-reuse race condiftion:Thread A acquires a
Socket's fd byfdSocket, when it's about to do some operations, the scheduler decide to pause thread A.Thread B close the socket, rewrite the
Socket'sIORef's content.Thread C open a new socket, unfortunately got the same fd number thread A is holding now.
When thread A is resumed, it's unaware of thread B and thread C 's behavior, thus the following operations will performed successfully, but on a wrong fd.
Maybe it's necessary to add some docs on
close?