[GHC] #8684: hWaitForInput cannot be interrupted by async exceptions on unix

GHC ghc-devs at haskell.org
Fri Sep 15 01:42:44 UTC 2017


#8684: hWaitForInput cannot be interrupted by async exceptions on unix
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  7.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:  13497, 13525      |             Blocking:
 Related Tickets:  #12912, #13525    |  Differential Rev(s):  Phab:D42
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nh2):

 Looking at this with `+RTS -Ds` again, we get:

 {{{
 created capset 0 of type 2
 created capset 1 of type 3
 cap 0: initialised
 assigned cap 0 to capset 0
 assigned cap 0 to capset 1
 new task (taskCount: 1)
 cap 0: created thread 1
 new bound thread (1)
 cap 0: schedule()
 cap 0: running thread 1 (ThreadRunGHC)
 fdReady called with msecs = 0
 fdReady res = 1
 setup
 cap 0: created thread 2
 cap 0: thread 1 stopped (suspended while making a foreign call)
 fdReady called with msecs = 5000
 fdReady res = -1
 ...
 [lots of output running only thread 1]
 ...
 cap 0: running thread 1 (ThreadRunGHC)
 cap 0: thread 1 stopped (suspended while making a foreign call)
 fdReady called with msecs = 4690
 fdReady res = -1
 cap 0: running thread 1 (ThreadRunGHC)
 cap 0: thread 1 stopped (suspended while making a foreign call)
 fdReady called with msecs = 4680
 fdReady res = 0
 cap 0: running thread 1 (ThreadRunGHC)
 cap 0: throwTo: from thread 1 to thread 2
   thread    2 @ 0x4200105aa0 is not blocked (TSO_DIRTY)
 cap 0: throwTo: blocking on thread 2
 cap 0: thread 1 stopped (blocked on throwTo)
   thread    1 @ 0x4200105388 is blocked on a throwto message (TSO_DIRTY)
 cap 0: running thread 2 (ThreadRunGHC)
 cap 0: raising exception in thread 2.
 cap 0: waking up thread 1 on cap 0
 cap 0: thread 2 stopped (yielding)
 cap 0: running thread 1 (ThreadRunGHC)
 }}}

 So the new question here is: Why is `thread 2` (the one that contains
 `unmask $ threadDelay n >> throwTo pid ex`) never run, and `thread 1` is
 run all the time?

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


More information about the ghc-tickets mailing list