#3291: "Thread blocked indefinitely" kills the program despite being caught
-----------------------------+----------------------------------------------
Reporter:  batterseapower    |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Runtime System  
 Version:  6.10.3            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 Perhaps this is just me misunderstanding the semantics of exceptions, but
 the following program:

 """
 import Test.HUnit.Lang
 import Control.Concurrent.STM

 import Control.Exception

 import Control.Concurrent
 import Control.Concurrent.MVar

 main = do
   mv <- newEmptyMVar
   forkIO $ do
         r <- performTestCase (atomically retry)
         print "Yeaahh!"
         print r
         evaluate r
         putMVar mv r
   print "Cool, let's see what we get"
   r <- takeMVar mv
   print r
   print "Am I printed?"
 """

 Should in my opinion, when run, print "Am I printed". This is because the
 "Thread blocked indefinitely" exception is caught by HUnit. However, this
 happens instead:

 """
 mbolingbr...@mb566 ~/Junk
 $ ./Repro
 "Cool, let's see what we get"
 "Yeaahh!"
 Just (False,"thread blocked indefinitely")
 Repro: thread blocked indefinitely
 """

 NB: I get the expected behaviour if I run it within GHCi, but not if I
 compile the program.

 This is causing problems for test-framework (see
 http://bsp.lighthouseapp.com/projects/15661-hs-test-framework/tickets/1
 -exits-immediately-on-thread-blocked-indefinitely-exception#ticket-1-2)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3291>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to