[GHC] #8433: forkProcess masks async exceptions inside the child process

#8433: forkProcess masks async exceptions inside the child process ------------------------------------+--------------------------------- Reporter: joeyh | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/unix | Version: 7.6.3 Keywords: | Operating System: Linux Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+--------------------------------- Frankly, I'm not sure if this is a bug, but the forkProcess documentation says nothing about it. This can lead to problems when writing a multi- threaded daemon that expects async exceptions to work as they usually would. FWIW, I have looked at several of the libraries on hackage that handle daemonization, and none of them seem to deal with this by explicitly unmasking exceptions when running the daemon IO action. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8433 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8433: forkProcess masks async exceptions inside the child process -----------------------------------+------------------------------------ Reporter: joeyh | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/unix | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -----------------------------------+------------------------------------ Comment (by hvr): Here's a simple way to reproduce: {{{#!hs System.Posix.Process.forkProcess $ print =<< Control.Exception.getMaskingState }}} outputs `MaskedInterrupt` with GHC 7.6.3 on Linux -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8433#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8433: forkProcess masks async exceptions inside the child process -----------------------------------+------------------------------------ Reporter: joeyh | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/unix | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -----------------------------------+------------------------------------ Comment (by hvr): Potential fix: {{{#!hs forkProcess :: IO () -> IO ProcessID forkProcess action = do -- wrap action to re-establish caller's masking state, as -- 'forkProcessPrim' starts in 'MaskedInterruptible' state by -- default; see also #1048 mstate <- getMaskingState let action' = case mstate of Unmasked -> unsafeUnmask action MaskedInterruptible -> action MaskedUninterruptible -> uninterruptibleMask_ action bracket (newStablePtr (runIO action')) freeStablePtr (\stable -> throwErrnoIfMinus1 "forkProcess" (forkProcessPrim stable)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8433#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8433: forkProcess masks async exceptions inside the child process
-----------------------------------+------------------------------------
Reporter: joeyh | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/unix | Version: 7.6.3
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-----------------------------------+------------------------------------
Comment (by Herbert Valerio Riedel

#8433: forkProcess masks async exceptions inside the child process
-----------------------------------+------------------------------------
Reporter: joeyh | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/unix | Version: 7.6.3
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-----------------------------------+------------------------------------
Comment (by Herbert Valerio Riedel

#8433: forkProcess masks async exceptions inside the child process ------------------------------------------------+-------------------------- Reporter: joeyh | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: libraries/unix | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Linux | Architecture: Type of failure: Incorrect result at runtime | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by hvr): * status: new => closed * failure: None/Unknown => Incorrect result at runtime * resolution: => fixed * milestone: => 7.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8433#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC