[GHC] #8087: Bug in IO manager when increasing the number of capabilities

#8087: Bug in IO manager when increasing the number of capabilities ------------------------------------+------------------------------------- Reporter: parcs | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.7 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Runtime crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- The new IO manager in HEAD has a logic error in the function responsible for creating more IO manager threads after increasing the number of capabilities with `setNumCapabilities`. This results in an index-out-of- range error later on in the program when one perform blocking IO. Test case: {{{ #!haskell import GHC.Conc main = do setNumCapabilities 2 getLine }}} {{{ $ ghc-stage2 -threaded program.hs $ ./program program: Ix{Int}.index: Index (1) out of range ((0,0)) }}} The fix is simple and will be arriving shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8087 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8087: Bug in IO manager when increasing the number of capabilities -------------------------------------+------------------------------------ Reporter: parcs | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by parcs): * status: new => patch Comment: Here's the fix: {{{ #!diff diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs index ca8ed1e..c4f83a0 100644 --- a/GHC/Event/Thread.hs +++ b/GHC/Event/Thread.hs @@ -339,7 +339,7 @@ ioManagerCapabilitiesChanged = do -- create new IO managers for the new caps: forM_ [old_n_caps..new_n_caps-1] $ - startIOManagerThread eventManagerArray + startIOManagerThread new_eventManagerArray -- update the event manager array reference: writeIORef eventManager new_eventManagerArray }}} `startIOManagerThread` should be writing the metadata about the new IO threads to the new event manager array, not the old array. I was going to update the testsuite but I am not sure how to formulate a test case that doesn't rely on stdin. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8087#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8087: Bug in IO manager when increasing the number of capabilities
-------------------------------------+------------------------------------
Reporter: parcs | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: libraries/base | Version: 7.7
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Changes (by igloo):
* status: patch => closed
* resolution: => fixed
Comment:
I couldn't find a way to make a test either. I've applied the patch
though; thanks!
{{{
commit a65ce1985d93250274eda16e0529bb5a9c93371b
Author: Ian Lynagh
participants (1)
-
GHC