#5969: Runtime crashes on parallel execution, GHC 7.0.4-7.4.1
-------------------------------+--------------------------------------------
    Reporter:  PeterisP        |       Owner:  simonmar     
        Type:  bug             |      Status:  new          
    Priority:  high            |   Milestone:  7.4.2        
   Component:  Runtime System  |     Version:  7.4.1        
    Keywords:                  |          Os:  MacOS X      
Architecture:  x86_64 (amd64)  |     Failure:  Runtime crash
  Difficulty:  Unknown         |    Testcase:               
   Blockedby:                  |    Blocking:               
     Related:                  |  
-------------------------------+--------------------------------------------
Changes (by simonmar):

  * component:  Compiler => Runtime System
  * priority:  normal => high
  * difficulty:  => Unknown
  * milestone:  => 7.4.2
  * owner:  => simonmar


Old description:

> Code gets runtime crashes if executed on multiple parallel threads with
> Control.Monad.Parallel.mapM - if the whole data is passed as one chunk to
> the mapM, then crashes are avoided.
>
> The crashes are repeatable (same code with the same data crashes 90% of
> time), but with different crash messages and place/time of crash.
> For example:
> "LNB_transform_source: internal error: stg_ap_p_ret
>     (GHC version 7.0.4 for x86_64_apple_darwin)
>     Please report this as a GHC bug:
> http://www.haskell.org/ghc/reportabug
> Abort trap: 6"
> Another: "Bus error: 10"
> Another, after successfully finishing execution
> "LNB_transform_source(22223,0x7fff7e200960) malloc: *** error for object
> 0x2c: pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Abort trap: 6"
> Another: "Segmentation fault: 11"
>
> I cannot isolate a minimalistic test case easily; the program is quite
> tricky and didn't crash when was simpler; however, the problems appeared
> around the same time as when xml parsing was switched from
> Text.XML.HXT.Core to Text.XML.Expat.SAX library, but there was a load of
> other changes at the same time.
>
> very rough code logic:
>   Control.Monad.Parallel.mapM processfiles [[filenames]]
>   Parallel.processfiles = do
>        outsideapphandles <- runInteractiveCommand "outsideapp"
>        mapM (processfile handles) [filenames]
>   processfile = do
>        file <- readfile filename
>        tokens <- SAX.parse file
>        outputtokens <- map (processtoken outsideapphandles) tokens
>        writefile outputtokens
>    processtoken = unsafeperformIO $ do
>        hPutStrLn inputhandle token
>        return hgetLine outputhandle

New description:

 Code gets runtime crashes if executed on multiple parallel threads with
 `Control.Monad.Parallel.mapM` - if the whole data is passed as one chunk
 to the `mapM`, then crashes are avoided.

 The crashes are repeatable (same code with the same data crashes 90% of
 time), but with different crash messages and place/time of crash.
 For example:
 {{{
 "LNB_transform_source: internal error: stg_ap_p_ret
     (GHC version 7.0.4 for x86_64_apple_darwin)
     Please report this as a GHC bug:
 http://www.haskell.org/ghc/reportabug
 Abort trap: 6"
 Another: "Bus error: 10"
 Another, after successfully finishing execution
 "LNB_transform_source(22223,0x7fff7e200960) malloc: *** error for object
 0x2c: pointer being freed was not allocated
 *** set a breakpoint in malloc_error_break to debug
 Abort trap: 6"
 Another: "Segmentation fault: 11"
 }}}
 I cannot isolate a minimalistic test case easily; the program is quite
 tricky and didn't crash when was simpler; however, the problems appeared
 around the same time as when xml parsing was switched from
 Text.XML.HXT.Core to Text.XML.Expat.SAX library, but there was a load of
 other changes at the same time.

 very rough code logic:
 {{{
   Control.Monad.Parallel.mapM processfiles [[filenames]]
   Parallel.processfiles = do
        outsideapphandles <- runInteractiveCommand "outsideapp"
        mapM (processfile handles) [filenames]
   processfile = do
        file <- readfile filename
        tokens <- SAX.parse file
        outputtokens <- map (processtoken outsideapphandles) tokens
        writefile outputtokens
    processtoken = unsafeperformIO $ do
        hPutStrLn inputhandle token
        return hgetLine outputhandle
 }}}

--

Comment:

 Thanks for the report.  Is there any chance you can let me have the code
 so I can reproduce it?

 This is probably the same bug as reported in #5085.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5969#comment:4>
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