Invariants for GHC.Event ensureIOManagerIsRunning

Edward Z. Yang ezyang at MIT.EDU
Sat Apr 14 05:53:32 CEST 2012

Hello all,

I recently ran into a rather reproduceable bug where I would
get this error from the event manager:

    /dev/null: hClose: user error (Pattern match failure in do expression at libraries/base/System/Event/Thread.hs:83:3-10)

The program was doing some rather strange things:

    - It was running the Haskell RTS inside another system (Urweb)
      which was making use of pthreads, sockets, etc.

    - The Haskell portion was linked against the threaded RTS, and doing
      communication with a process.

and is rather complicated (two compilers are involved).  But
the gist of the matter is that if I added a quick call to
ensureIOManagerIsRunning after hs_init, the error went away.

So, if the IO manager is not eagerly loaded at the call to hs_init,
how do we decided when it should be loaded?  It seems probably that
we missed a case.


P.S. I tried reproducing on a simple test case but couldn't manage it.

More information about the Glasgow-haskell-users mailing list