GHC threaded RTS will call the finaliser of a ForeignPtr while references still exist

I believe that I've managed to distill a crash which has been driving me crazy for a few days into a short enough test case (22 lines) that it might be useful. In short: the threaded RTS will call the finialiser of a ForeignPtr while an exception handler still holds a reference to it: % ghc -make fptest.hs cbits.c -threaded [1 of 1] Compiling Main ( fptest.hs, fptest.o ) Linking fptest ... % ./fptest New object getting created: 66f010 Finaliser getting called for 66f010 Use called for 66f010 cbits.c: http://hpaste.org/6420 fptest.hs: http://hpaste.org/6421 I'm hoping that this is useful to someone who knows the RTS. Cheers, -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org

On Sun, Mar 16, 2008 at 8:40 PM, Adam Langley
I believe that I've managed to distill a crash which has been driving me crazy for a few days into a short enough test case (22 lines) that it might be useful.
Cale made a suggestion which shortens it: fptest.hs: http://hpaste.org/6423 -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org

agl:
I believe that I've managed to distill a crash which has been driving me crazy for a few days into a short enough test case (22 lines) that it might be useful.
In short: the threaded RTS will call the finialiser of a ForeignPtr while an exception handler still holds a reference to it:
% ghc -make fptest.hs cbits.c -threaded [1 of 1] Compiling Main ( fptest.hs, fptest.o ) Linking fptest ... % ./fptest New object getting created: 66f010 Finaliser getting called for 66f010 Use called for 66f010
cbits.c: http://hpaste.org/6420 fptest.hs: http://hpaste.org/6421
I'm hoping that this is useful to someone who knows the RTS.
Create a ticket on the bug tracker, and I'm sure Ian or Simon M will have a look at it. http://hackage.haskell.org/trac/ghc/newticket?type=bug -- Don

On Sun, Mar 16, 2008 at 8:45 PM, Don Stewart
Create a ticket on the bug tracker, and I'm sure Ian or Simon M will have a look at it.
Done, thanks: http://hackage.haskell.org/trac/ghc/ticket/2161 AGL -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
participants (2)
-
Adam Langley
-
Don Stewart