[GHC] #4934: threadWaitRead works incorrectly on nonthreaded RTS

GHC ghc-devs at haskell.org
Thu Jun 5 15:41:05 UTC 2014


#4934: threadWaitRead works incorrectly on nonthreaded RTS
------------------------------------------------+--------------------------
        Reporter:  slyfox                       |            Owner:
            Type:  bug                          |           Status:  new
        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):

 0003-rts-posix-Select.c-throw-exception-to-reader-as-soon.patch
 adds another step to kill thread on '''threadWaitRead'''.

 Now it works as:
 {{{
 [1 of 1] Compiling Main             ( a.hs, a.o )
 Linking a ...
 a: awaitEvent: invalid argument (Bad file descriptor)
 a: user error (If you can read this, shutdownHaskellAndExit did not exit.)
 }}}

 The problem is the status of killed thread.
 RTS thinks it did not finish, but blocked on FFI call:

 {{{
 $ ./a +RTS -D{s,i,r,S,z}
 cap 0: thread 1 stopped (blocked on a read operation)
         thread    1 @ 0x7fd2fa405390 is blocked on read from fd 12
 (TSO_DIRTY)
 scheduler: checking for threads blocked on I/O (waiting)
 found bad READ fd=12
 cap 0: raising exception in thread 1.
 Waking up blocked thread 1
 cap 0: running thread 1 (ThreadRunGHC)
 a: awaitEvent: invalid argument (Bad file descriptor)
 cap 0: thread 1 stopped (suspended while making a foreign call)
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/4934#comment:17>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list