Ticket #5969 (closed bug: invalid)

Opened 15 months ago

Last modified 14 months ago

Runtime crashes on parallel execution, GHC 7.0.4-7.4.1

Reported by: PeterisP Owned by: simonmar
Priority: high Milestone: 7.4.2
Component: Runtime System Version: 7.4.1
Keywords: Cc: PeterisP@…, stephen.blackheath@…
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: Runtime crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar) (diff)

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

Change History

in reply to: ↑ description   Changed 15 months ago by PeterisP

Replying to PeterisP: Can't figure out how to edit the error description to remove the red box - that line was mant to be

Control.Monad.Parallel.mapM processfiles [ [filenames] ]

  Changed 15 months ago by PeterisP

Ah, forgot to add the compiler settings: ghc --make -O -feager-blackholing -threaded -rtsopts -fforce-recomp LNB_transform_source.hs and +RTS -N4 when executing - it's run on a quad-code machine and the Parallel.mapM is also given 4 chunks of file names.

  Changed 15 months ago by PeterisP

  • cc PeterisP@… added
  • version changed from 7.0.4 to 7.4.1
  • summary changed from Runtime crashes on parallel execution, GHC 7.0.4 to Runtime crashes on parallel execution, GHC 7.0.4-7.4.1

Upgraded to GHC 7.4.1 and the same runtime crash behavior repeats:

LNB_transform_source: internal error: stg_ap_p_ret

(GHC version 7.4.1 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug

Abort trap: 6

  Changed 14 months ago by simonmar

  • description modified (diff)
  • component changed from Compiler to Runtime System
  • priority changed from normal to high
  • difficulty set to Unknown
  • milestone set to 7.4.2
  • owner set to simonmar

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.

  Changed 14 months ago by PeterisP

The code is a bit tricky to set up (it involves an external Java library and a number of data files to be processed), but it still fails predictably within a couple of seconds. I can try to put it somewhere where it can be accessed remotely, or e-mail it to you (to what address?)

  Changed 14 months ago by simonmar

Use whatever method is most convenient for you - attaching to this ticket is fine, or email me at marlowsd@…. If you could elimiante the need for the Java library that would help a lot.

  Changed 14 months ago by simonmar

  • cc stephen.blackheath@… added
  • status changed from new to closed
  • resolution set to invalid

After some investigation this appears to be a bug in the hexpat package. I've informed the maintainer who is looking into it.

Note: See TracTickets for help on using tickets.