1 Dec 2012 21:04
debugging memory corruption
Evan Laforge <qdunkan <at> gmail.com>
2012-12-01 20:04:46 GMT
2012-12-01 20:04:46 GMT
Ever since upgrading to 7.6.1 I regularly get panics like this:
seq: internal error: evacuate: strange closure type -1958168540
(GHC version 7.6.1 for x86_64_apple_darwin)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I've seen some variations, but basically I think it just means someone
is corrupting memory and it goes unnoticed until the GC trips over it.
This happens infrequently (maybe once in 15m, very roughly, it's
extremely inconsistent) in non-optimized code, and frequently (maybe
once in 5m) in optimized code. This only happens during interactive
use, not during testing or profiling.
I had a problem like this once before, and it took a very long time to
track down. And in fact, I never really tracked it down, I just got a
test that could semi-reliably reproduce it, and then by trial and
error discovered that if I changed the alignment of a particular
Storable instance from 1 to 4, the problem stopped happening (and 1
should have been correct, it was a struct of chars). Not exactly a
satisfying solution, and now I'm thinking all I did was make ghc 6
stop manifesting it, and with 7 it's back again.
I'm most suspicious of the FFI usage since it's easy to corrupt memory
in C++ and even easier to write a bogus Storable instance that does
the same, but I really have no idea what or where. My first thought
was to start cutting out portions (especially FFI-using portions) to
try to isolate it, but it's slow going because it can sometimes take
quite a while to the bug to come out again. My second thought was
that I need a more automated way to reproduce it, but it's nontrivial
(Continue reading)
RSS Feed