[Haskell-cafe] Debugging misbehaving multi-threaded programs

Claus Reinke claus.reinke at talk21.com
Thu Jun 11 04:43:09 EDT 2009


> I've written a multi-threaded Haskell program that I'm trying to
> debug. Basically what's happening is the program runs for a while, and
> then at some point one of the threads goes crazy and spins the CPU
> while allocating memory; this proceeds until the system runs out of
> available memory. I can't fix this without figuring out what code is
> being executed in the loop (or at least which thread is misbehaving,
> which would narrow things down a lot).
>..
> Does anyone have any tips for dealing this? Have other people run into
> similar problems? I'm out of ideas, so I'm open to any suggestions.

Don't know whether this still works, but there was a Concurrent
Haskell Debugger here:

http://www.informatik.uni-kiel.de/~fhu/chd/

The idea being that you put an indirection module between your
code and the Concurrent Haskell imports, and then instrument
the indirections to give you more information (they had built 
more tools on top of that idea).

In a similar direction, I once suggested a shell-jobs-like thread
interface for GHCi, in the context of this _|_-ed ticket:

http://hackage.haskell.org/trac/ghc/ticket/1399#comment:3

Claus




More information about the Haskell-Cafe mailing list