RTS/IOManager: fix trac issue #9722.

Authored by AndreasVoellmy on Mar 9 2015, 3:10 PM.



Whenever the RTS has been inactive for idleGCDelayTime, the idle timer
fires and calls wakeUpRts(), which in turn calls ioManagerWakeup(),
which in turn writes a byte (or a few) to a file descriptor (stored in
the io_manager_wakeup_fd variable) registered by the TimerManager and
on which the TimerManager will wait. (Note that the write will only
occur if the file descriptor is non-negative.) When the RTS shuts
down, it shuts down the TimerManager, and in this process the file
descriptor stored in io_manager_wakeup_fd is closed. In the error
case, the idle timer fires after the close of the file occurs, and
then the write() call in ioManagerWakeup() fails and the
aforementioned error message gets printed.

This patch solves the problem by (1) having the TimerManager (via
Control) write -1 to io_manager_wakeup_fd just before closing the file
descriptor written in io_manager_wakeup_fd, and (2) having
ioManagerWakeup() ignore an error returned by write() in the case that
the write returned -1 and the io_manager_wakeup_fd is -1.

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
AndreasVoellmy retitled this revision from to RTS/IOManager: fix trac issue #9722..
AndreasVoellmy updated this object.
AndreasVoellmy edited the test plan for this revision. (Show Details)
AndreasVoellmy added reviewers: austin, simonmar, thomie.
AndreasVoellmy edited edge metadata.
AndreasVoellmy updated the Trac tickets for this revision.
thomie accepted this revision.Mar 9 2015, 4:06 PM
thomie edited edge metadata.
This revision is now accepted and ready to land.Mar 9 2015, 4:06 PM
This revision was automatically updated to reflect the committed changes.