Quantcast

Invariants for GHC.Event ensureIOManagerIsRunning

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Invariants for GHC.Event ensureIOManagerIsRunning

Edward Z. Yang
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.

Edward

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

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Invariants for GHC.Event ensureIOManagerIsRunning

Johan Tibell-2
The intention is that the I/O manager should start with the RTS. It's
started in hs_init_ghc if you're running the threaded RTS. I don't
know enough about using ghc as a library to know if it needs to be
started in some other context as well.

-- Johan

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Invariants for GHC.Event ensureIOManagerIsRunning

Simon Marlow-7
In reply to this post by Edward Z. Yang
On 14/04/2012 04:53, Edward Z. Yang wrote:

> 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.
>
> Edward
>
> P.S. I tried reproducing on a simple test case but couldn't manage it.

Looking at the code I can't see how that can happen, so if you do manage
to reproduce it on a small example, please file a bug.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Loading...