Fix dropped event registrations

Authored by bgamari on Apr 16 2015, 7:23 PM.



D347 introduced a bug wherein the event manager would drop registrations that
should be retained during processing. This occurs when an fd has multiple
registrations, not all of which fire, as well as the case of multi-shot

I also do some general house-keeping, try to better document things, and fix a
bug which could result in unnecessary calls to epoll_ctl

Test Plan

Clearly w need more tests. Working on this.

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.
bgamari updated this revision to Diff 2780.Apr 16 2015, 7:23 PM
bgamari retitled this revision from to Fix dropped event registrations.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari added reviewers: AndreasVoellmy, austin.
bgamari updated the Trac tickets for this revision.
bgamari updated this revision to Diff 2781.Apr 16 2015, 7:27 PM
bgamari edited edge metadata.
  • Fix line length

Glad you found this. First priority is probably to get a test that demonstrates that the bug can happen.

This was realized by Bas in his usb package. This test reproduces the issue on 7.10 but works with this fix.

I've put together a pair of tests exercising both failure modes caused by this bug. We should probably find a way to incorporate these into GHC's testsuite.

pacak added a subscriber: pacak.May 5 2015, 6:50 PM
pacak added a comment.May 5 2015, 7:19 PM

Somehow base commit is missing from this diff. This ticket looks relevant, but I can't test it locally

akio added a subscriber: akio.May 5 2015, 9:16 PM
liyang added a subscriber: liyang.May 6 2015, 12:04 AM
maoe added a subscriber: maoe.May 6 2015, 6:23 PM
carter added a subscriber: carter.May 6 2015, 7:38 PM
carter added inline comments.

Question: should lifetime be exported by GHC.Event?
its not documented in the public haddocks for 7.10 base :(

@carter, this was an oversight that will be fixed by D838.

austin accepted this revision.May 11 2015, 3:38 AM
austin edited edge metadata.

Alright, this LGTM. Ben, you can commit this when you feel ready, although a reliable test would be great...

This revision is now accepted and ready to land.May 11 2015, 3:38 AM
This revision was automatically updated to reflect the committed changes.