Dear gtk2hs developers,

What's the current state of gtk2hs with respect to the threaded RTS and 
C finalizers?  Should we expect 0.10.1 to work?

As you may know, we're working on ThreadScope, a gtk2hs-based tool for 
parallel performance visualisation in GHC.  I recently switched to use 
the threaded RTS so that I could do some work while displaying a 
progress bar - I know there are ways to do this without -threaded, but I 
thought -threaded would be the neatest way to do it, and eventually 
we'll want to have background threads doing things anyway.

Now I have weird problems - usually hangs/deadlocks, but occasionally I 
get an Xlib error.  Here's my latest hang, which is 100% reproducible on 
exiting ThreadScope right now:

(gdb) where
#0  0x0000003c0aa0af19 in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib64/libpthread.so.0
#1  0x00000000005b2c0e in waitCondition (pCond=0x1a43918, 
pMut=0x1a43948) at posix/OSThreads.c:65
#2  0x00000000005d72d9 in waitForReturnCapability (pCap=0x7ffffe1499f0, 
task=0x1a438e0) at Capability.c:445
#3  0x00000000005a5934 in rts_lock () at RtsAPI.c:572
#4  0x00000000004cf247 in SystemziGlibziGObject_d1wV ()
#5  0x0000003c10cd8eed in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#6  0x0000003c0ba0d6a8 in g_object_unref () from /lib64/libgobject-2.0.so.0
.... various stuff omitted ....
#41 0x0000003c0ba0d632 in g_object_unref () from /lib64/libgobject-2.0.so.0
#42 0x00000000005b20fd in runCFinalizer (fn=0x408968, ptr=0x1a69440, 
env=0x0, flag=0) at Weak.c:34
#43 0x00000000005b216a in runAllCFinalizers (list=0x2afbacb5f060) at 
Weak.c:50
#44 0x00000000005a8077 in hs_exit_ (wait_foreign=rtsFalse) at 
RtsStartup.c:413
#45 0x00000000005a81a8 in shutdownHaskellAndExit (n=0) at RtsStartup.c:557
#46 0x00000000005a4c6a in real_main () at Main.c:144
#47 0x00000000005a4ca4 in main (argc=5, argv=0x7ffffe14b338) at Main.c:156

So clearly g_object_unref is being called from a C finalizer, and it 
ends up calling back into Haskell via something in System.Glib.Object, 
this leads to a deadlock because the RTS is shutting down and can't run 
any Haskell code.

Any help appreciated.  In the meantime I'll probably go back to the 
single-threaded RTS.

Cheers,
        Simon

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to