[GHC] #14912: UnsafeReenter test fails with threaded1 and threaded2

GHC ghc-devs at haskell.org
Mon Mar 12 13:58:54 UTC 2018


#14912: UnsafeReenter test fails with threaded1 and threaded2
--------------------------------------+---------------------------------
           Reporter:  alpmestan       |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  Runtime System  |           Version:  8.5
           Keywords:                  |  Operating System:  Linux
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 {{{
   /tmp/ghctest-n4fi8zlk/test   spaces/./ffi/should_fail/UnsafeReenter.run
 UnsafeReenter [bad exit code] (threaded1)
   /tmp/ghctest-n4fi8zlk/test   spaces/./ffi/should_fail/UnsafeReenter.run
 UnsafeReenter [bad exit code] (threaded2)
 }}}

 It's a quite simple program:

 {{{#!hs
 {-# LANGUAGE ForeignFunctionInterface #-}

 -- | Test that unsafe FFI calls crash the RTS if they attempt to re-enter
 -- Haskell-land
 module Main where

 import Foreign

 foreign import ccall "wrapper" wrap_f :: IO () -> IO (FunPtr (IO ()))
 foreign import ccall unsafe hello :: FunPtr (IO ()) -> IO ()

 f :: IO ()
 f = putStrLn "Back in Haskell"

 main :: IO ()
 main = do
     putStrLn "In Haskell"
     wrap_f f >>= hello
     putStrLn "Finished"
 }}}

 This just seem to hang (until timeout) with the `threaded1` and
 `threaded2` ways, instead of erroring out with:

 {{{
   UnsafeReenter: schedule: re-entered unsafely.
      Perhaps a 'foreign import unsafe' should be 'safe'?
 }}}

 which is the expected behaviour. I'll mark the test broken for those 2
 ways in an upcoming patch, but this probably deserves a new ticket, so
 here it is.

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


More information about the ghc-tickets mailing list