Opened 10 years ago

Closed 10 years ago

Last modified 2 years ago

#713 closed bug (fixed)

SMP + FFI = crash...

Reported by: lipeng@… Owned by:
Priority: high Milestone: 6.6
Component: Runtime System Version: 6.5
Keywords: smp ffi crash Cc:
Operating System: Linux Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Source code will be attached. This is a modified version of bug #705: each thread calls a safe C function via FFI. The normal behavior of the program is to loop forever. The program works fine using +RTS -N1, but when using +RTS -N2 or more threads on a SMP machine, it crashes nondeterministically with all kinds of funny error messages. I can reproduce it on difference linux SMP machines.

Attachments (1)

smpbug.tar.gz (1.6 KB) - added by lipeng@… 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by lipeng@…

comment:1 Changed 10 years ago by lipeng@…

By the way, I am using the 20050302 version of GHC.

comment:2 Changed 10 years ago by lipeng@…

sorry, it's ghc-6.5-20060302, not 2005 :)

comment:3 Changed 10 years ago by simonmar

  • Component changed from Compiler to Runtime System
  • Milestone set to 6.6
  • Priority changed from normal to high

comment:4 Changed 10 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

Thank you, this was a really useful bug report. I found at least 2 bugs, one of which took more than a man day to find :-( There was no problem with the FFI, by the way - I removed the FFI call from your program and the crash still happened. The main bug was a subtle race in the runtime when two threads were evaluating the same thunk.

comment:5 Changed 2 years ago by Simon Marlow <simonmar@…>

Note: See TracTickets for help on using tickets.