[GHC] #15136: High CPU when asynchronous exception and unblocking retry on TVar raced

GHC ghc-devs at haskell.org
Tue Jun 12 19:26:45 UTC 2018


#15136: High CPU when asynchronous exception and unblocking retry on TVar raced
-------------------------------------+-------------------------------------
        Reporter:  nshimaza          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.6.1
       Component:  Runtime System    |              Version:  8.4.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Runtime crash     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonmar):

 Thanks for the excellent diagnosis @bgamari.

 I'm not sure what the best fix is yet, but there is something distinctly
 strange here. `lockTSO` and `unlockTSO` are only used to synchronise for
 this particular case, between `raiseAsync` and `unpark_tso`. In all other
 cases, a TSO has a clear owner - in the case of a blocked TSO, the owner
 is usually the object on which the TSO is blocked, e.g. an MVar. Perhaps
 we should switch to using an owner semantics for BlockedOnSTM too - that
 is, if we see `BlockedOnSTM` in `raiseAsync`, we attempt to lock the
 `TVar` pointed to by `tso->block_info`.

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


More information about the ghc-tickets mailing list