[GHC] #2161: GHC threaded RTS will call the finaliser of a ForeignPtr while references still exist

GHC trac at galois.com
Sun Mar 16 23:54:04 EDT 2008


#2161: GHC threaded RTS will call the finaliser of a ForeignPtr while references
still exist
-------------------------------+--------------------------------------------
    Reporter:  agl             |       Owner:                
        Type:  bug             |      Status:  new           
    Priority:  normal          |   Component:  Runtime System
     Version:  6.8.2           |    Severity:  major         
    Keywords:                  |    Testcase:                
Architecture:  x86_64 (amd64)  |          Os:  Linux         
-------------------------------+--------------------------------------------
 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

 }}}

 I'm hoping that this is useful to someone who knows the RTS.

 Cheers,

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2161>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list