[GHC] #4934: threadWaitRead works incorrectly on nonthreaded RTS
GHC
ghc-devs at haskell.org
Fri Jun 6 09:20:09 UTC 2014
#4934: threadWaitRead works incorrectly on nonthreaded RTS
------------------------------------------------+--------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: normal | Milestone: ⊥
Component: Runtime System | Version: 7.0.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Incorrect result at runtime | (amd64)
Test Case: | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
------------------------------------------------+--------------------------
Comment (by slyfox):
> Yes, please squash the patches and then I'll review.
Will do.
> Not sure what you mean by "slightly change polling cycle to resume only
descriptors with data available", don't we already do that?
I was a bit unclear. I meant: only in a case of '''select() == EBADF'''
failure we
always resumed all the blocked threads:
https://ghc.haskell.org/trac/ghc/browser/ghc/rts/posix/Select.c#L295
{{{
if ( errno == EBADF )
unblock_all = rtsTrue;
...
ready = unblock_all || FD_ISSET(tso->block_info.fd, &rfd); // [1]
...
if (ready)
pushOnRunQueue(&MainCapability,tso);
}}}
Current patchset only propagates exceptions early,
but does not fix spurious resumes (as it was before).
I propose to fix resume problem:
{{{
--- ready = unblock_all || FD_ISSET(tso->block_info.fd, &rfd);
+++ if (unblock_all) ready = fd_is_really_ready (fd);
+++ else ready = FD_ISSET(tso->block_info.fd, &rfd);
}}}
It' won't be hard to implement on top of current patchset.
Secondary '''select()''' can already provide all the info.
Should I do it as a) a separate patch/ticket, b) merge into final result,
c) don't touch it at all?
Thanks!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/4934#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list