Opened 5 years ago

Closed 5 years ago

#7317 closed bug (fixed)

Segmentation fault in RTS' STM code on git master

Reported by: bgamari Owned by:
Priority: normal Milestone: 7.8.1
Component: Runtime System Version: 7.7
Keywords: rts, stm, segv Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


On ghc 7.7 (ef786b6cbc5f67a673bf8c10be5311317c1e7b88, running on x86_64, Linux) I'm observing a segmentation fault in compiled code (bayes-stack-ci from The crash appears to originate in the RTS while aborting a transaction,

$ gdb --args bayes-stack-ci --nodes=texts --arcs=links --topics=10 --sweeps=sweeps
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/ben/.cabal/bin/bayes-stack-ci...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/ben/.cabal/bin/bayes-stack-ci --nodes=texts --arcs=links --topics=10 --sweeps=sweeps
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".
[New Thread 0x7fffedeff700 (LWP 32590)]
[New Thread 0x7fffed6fe700 (LWP 32591)]
Read 0 stopwords
Read 2 arcs, 3 nodeItems
Starting sampler...
Burning in for 100 samples

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffed6fe700 (LWP 32591)]
0x00007ffff4094743 in merge_read_into () from /opt/exp/ghc/root-7.7/lib/ghc-7.7.20121009/rts-1.0/
(gdb) bt
#0  0x00007ffff4094743 in merge_read_into () from /opt/exp/ghc/root-7.7/lib/ghc-7.7.20121009/rts-1.0/
#1  0x00007ffff40949db in stmAbortTransaction () from /opt/exp/ghc/root-7.7/lib/ghc-7.7.20121009/rts-1.0/
#2  0x00007ffff40a8c3b in stg_atomically_frame_info () from /opt/exp/ghc/root-7.7/lib/ghc-7.7.20121009/rts-1.0/
#3  0x0000000000000000 in ?? ()

Change History (3)

comment:1 Changed 5 years ago by fryguybob

Are the files texts and links available for reproducing the issue?

comment:2 Changed 5 years ago by bgamari

The following should work,


1 2
1 3


1 this is a small node
2 this is a larger node with more items
3 this has items

comment:3 Changed 5 years ago by simonmar

difficulty: Unknown
Milestone: 7.8.1
Resolution: fixed
Status: newclosed

I believe I just fixed this, in

commit 412af8c2eb2f2c689f77fa9e061d45eaa37110f1
Author: Simon Marlow <>
Date:   Mon Oct 22 11:43:18 2012 +0100

    Foreign calls can clobber heap & stack memory too
    We were making an aggressive assumption that foreign calls cannot
    clobber heap or stack memory, which for the majority of foreign calls
    is true, but we violate the assumption in the implementation of
    primops in the RTS.  This was causing crashes in some STM tests.

Please re-open the ticket if you still encounter problems.

Note: See TracTickets for help on using tickets.