hPutBuf synchronous?

David Roundy droundy at abridgegame.org
Tue Jul 27 06:17:13 EDT 2004

Hello all,

I've been trying to track down a "Bus error" that one of my users is
getting on the macintosh, and am at the point of having just one idea as to
what might be causing it.

The error happens during garbage collection, as far as I can tell.  He
compiled darcs using ghc 6.2.1.

My only theory is that perhaps hGetBuf (or maybe hPutBuf) isn't actually
synchronous on some platforms? If this were the case, of course, using
h{Get,Put}Buf on a pointer within withForeignPtr might be dangerous, since
the ForeignPtr could be GCed before the hGetBuf actually takes place.  It's
hard to imagine that this actually is the case, but I'm really running out
of ideas as to what could cause this bus error he's seeing.  It's not 100%
reproducible, but goes away if he makes the GC triggered less often (in
darcs I trigger GCs manually before doing a large mallocForeignPtr to keep
memory usage down), and when we added a debug message finalizer, he sees it
considerably less often.  Alas, I've been unable to reproduce it myself,
and his repository that displays this behavior contains private data.

Any suggestions and/or insight would be welcome.
David Roundy

More information about the Glasgow-haskell-users mailing list