[GHC] #15312: getChanContents exception behavior seems a bit odd

GHC ghc-devs at haskell.org
Tue Jun 26 04:55:11 UTC 2018


#15312: getChanContents exception behavior seems a bit odd
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Core Libraries    |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 The basic problem seems to be that `readChan` uses `modifyMVar`, which
 uses `onException`, which catches arbitrary exceptions and rethrows them
 as synchronous exceptions:

 {{{#!hs
 onException :: IO a -> IO b -> IO a
 onException io what = io `catch` \e -> do _ <- what
                                           throwIO (e :: SomeException)
 }}}

 I don't think `readChan` can throw any synchronous exceptions, so perhaps
 it should rethrow any exceptions it receives asynchronously and retry.

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


More information about the ghc-tickets mailing list