Opened 5 years ago

Closed 2 years ago

#5443 closed bug (worksforme)

Errors when shutting down the event manager loop

Reported by: basvandijk Owned by: tibbe
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.2.1
Keywords: Cc: johan.tibell@…, bos@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


As explained in this thread on the GHC list I use the GHC event manager in my usb library. I create my own EventManager and start a thread which runs the event manager loop. When the library is finalized I automatically shutdown the loop. However this causes error messages from the RTS to be printed.

The following program shows the problem in isolation:

import Control.Concurrent
import GHC.Event

main = do
 em <- new
 tid <- forkIO $ loop em
 threadDelay 2000000
 shutdown em  -- Note that 'killThread tid' has the same effect.
 threadDelay 2000000

Make sure to build it with -threaded enabled:

$ ghc -threaded --make eventManagerBug.hs

Running it gives the following errors:

$ ./eventManagerBug
example: ioManagerWakeup: write: Bad file descriptor
example: ioManagerDie: write: Bad file descriptor

Note that these errors are printed in the ioManagerWakeup function in rts/posix/Signals.c.

Change History (6)

comment:1 Changed 5 years ago by igloo

Milestone: 7.6.1
Owner: set to tibbe

comment:2 Changed 4 years ago by igloo


comment:3 Changed 3 years ago by thoughtpolice


Moving to 7.10.1.

comment:4 Changed 2 years ago by thomie

difficulty: Unknown

I can't tell at the moment whether this is still an issue or not. base-4.7 does not export the functions loop and shutdown, see

comment:5 Changed 2 years ago by basvandijk

I can't tell at the moment whether this is still an issue or not.

In my usb library it's not a problem anymore since I'm now using the system event manager. So closing this ticket is fine with me.

comment:6 Changed 2 years ago by thomie

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.