[Haskell-cafe] Socket not released

Donn Cave donn at avvanta.com
Sun Aug 8 01:45:46 EDT 2010

Quoth Jonathan Geddes <geddes.jonathan at gmail.com>,

> ... but here's what I'm seeing. The process tries n times
> to acquire the socket, pausing for a second or so between attempts.
> While running a "child" process I will run a fresh process so that the
> two processes are competing for the socket, but neither of them are
> getting it. In half a dozen such test cases the fresh process grabs
> the socket on the very next attempt after the child process is
> interrupted. But if I interrupt the fresh process, the child process
> continues to fail to acquire the socket.

You need to close the parent's socket in the child fork, as well as
the parent - if it's inherited by the child, it's held open there,
even if the parent closes it.

	Donn Cave, donn at avvanta.com

More information about the Haskell-Cafe mailing list