BlockedIndefinitelyOnMVar exception
Simon Marlow
marlowsd at gmail.com
Tue Jun 29 16:53:17 EDT 2010
On 26/06/10 12:28, Neil Mitchell wrote:
> I have a very big and highly threaded program that generates a
> BlockedIndefinitelyOnMVar exception when run. I have spent a
> reasonable amount of time pouring over the source code, as has Max
> Bolingbroke. Neither of us have the slightest idea why it raises the
> exception.
>
> Some questions:
>
> * Does anyone know the exact sequence of actions that causes this
> exception to be thrown? I couldn't find it written down.
Sure - it means the garbage collector found that the thread was blocked
on an MVar that is otherwise unreachable, and hence the thread could
never be awoken.
> * How confident are people that this exception does really mean that
> it is in a blocked state? Is there any chance the error could be
> raised incorrectly?
There have been one or two bugs in the past that could lead to this
exception being raised incorrectly, but I'm not aware of any right now.
It's not inconceivable of course.
> * Any debugging tips for this problem?
I'd use the event log: compile with -debug, run with +RTS -Ds -l, and
dump the event log with show-ghc-events (cabal install ghc-events). Or
just dump it to stderr with +RTS -Ds, if the log isn't too large. Use
GHC.Exts.traceEvent to add your own events to the trace.
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list