[Haskell-cafe] Spurious program crashes

Simon Marlow simonmar at microsoft.com
Thu Nov 17 10:00:55 EST 2005

On 16 November 2005 17:38, Joel Reymont wrote:

> I'm getting crashes like this and I cannot figure out what the
> problem is. I'm launching a bunch of threads that connect to a server
> via TCP and exchange packets.
> I am running operations like connect and receive in a timeout
> function that launches two threads and uses an MVar to figure out
> who's done first. The timeout function then kills the two threads.
> Any ideas what could be causing this? I feel like a Haskell guinea
> pig these days :-).

I don't see any reason why you should be getting crashes here, but this
is a delicate area (async exceptions + FFI).  It's possible there's a
bug, but as usual we need to reproduce the symptoms here.  Can you help
with a repro case?

Regarding the behaviour of killThread, I believe the version in GHC is
slightly different from the version described in the Asynchronous
Exceptions paper, in particular the GHC version blocks until the
exception has been delivered to the target thread (use another forkIO to
get the fully async version).


More information about the Haskell-Cafe mailing list