[Moonlight-list] Valgrind

Rolf Bjarne Kvinge rolflists at ya.com
Thu Jan 28 07:48:01 EST 2010


Hi,

If you use valgrind and get something like this on exit (and possibly
deadlocks/crashes):

==20940== Invalid read of size 4
==20940==    at 0x8057E46: free (in /usr/lib/firefox/firefox)
==20940==    by 0x4011406: _dl_deallocate_tls (dl-tls.c:481)
==20940==    by 0x4161480: __free_stacks (allocatestack.c:274)
==20940==    by 0x416158D: __deallocate_stack (allocatestack.c:302)
==20940==    by 0x4162869: pthread_join (pthread_join.c:110)
==20940==    by 0x44C48EA: PR_JoinThread (ptthread.c:601)
==20940==    by 0x576E1AA: nsThread::Shutdown() (nsThread.cpp:472)
==20940==    by 0x556C1D4: nsUrlClassifierDBService::Shutdown()
(nsUrlClassifierDBService.cpp:4303)
==20940==    by 0x556D6DC: nsUrlClassifierDBService::Observe(nsISupports*,
char const*, unsigned short const*) (nsUrlClassifierDBService.cpp:4259)
==20940==    by 0x5747AE4: nsObserverList::NotifyObservers(nsISupports*,
char const*, unsigned short const*) (nsObserverList.cpp:128)
==20940==    by 0x5747DE2: nsObserverService::NotifyObservers(nsISupports*,
char const*, unsigned short const*) (nsObserverService.cpp:181)
==20940==    by 0x4E9AA60: nsXREDirProvider::DoShutdown()
(nsXREDirProvider.cpp:876)
==20940==  Address 0x18b00000 is 64 bytes inside a block of size 68 free'd
==20940==    at 0x40265BD: operator delete(void*) (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==20940==    by 0x10EBA083: RenderingEventArgs::~RenderingEventArgs()
(eventargs.cpp:60)
==20940==    by 0x10E746EB: EventObject::unref() (dependencyobject.cpp:418)
==20940==    by 0x10E7671A: EventObject::DoEmit(int, EventArgs*)
(dependencyobject.cpp:1090)
==20940==    by 0x10E7632E: EventObject::Emit(int, EventArgs*, bool, int)
(dependencyobject.cpp:1022)
==20940==    by 0x10F977C1: TimeManager::SourceTick() (timemanager.cpp:438)
==20940==    by 0x10F96CD3: TimeManager::source_tick_callback(EventObject*,
EventArgs*, void*) (timemanager.cpp:170)
==20940==    by 0x10E768BB: EventObject::DoEmitCurrentContext(int,
EventArgs*) (dependencyobject.cpp:1121)
==20940==    by 0x10E76709: EventObject::DoEmit(int, EventArgs*)
(dependencyobject.cpp:1086)
==20940==    by 0x10E7632E: EventObject::Emit(int, EventArgs*, bool, int)
(dependencyobject.cpp:1022)
==20940==    by 0x10F98782: SystemTimeSource::tick_timeout(void*)
(timesource.cpp:164)
==20940==    by 0x61B7B8E: g_timeout_dispatch (gmain.c:3396)
==20940== Invalid read of size 1
==20940==    at 0x8057E52: free (in /usr/lib/firefox/firefox)
==20940==    by 0x4011406: _dl_deallocate_tls (dl-tls.c:481)
==20940==    by 0x4161480: __free_stacks (allocatestack.c:274)
==20940==    by 0x416BFAF: ??? (in /lib/libpthread-2.10.1.so)
==20940==    by 0x4212167: _Exit (_exit.S:30)
==20940==    by 0xFFFFFFFE: ???
==20940==  Address 0xfd002e8 is 0 bytes inside a block of size 16 free'd
==20940==    at 0x40265BD: operator delete(void*) (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==20940==    by 0x10E7CFF2: EmitContextNode::~EmitContextNode()
(dependencyobject.cpp:77)
==20940==    by 0x10E76AA4: EventObject::FinishEmit(int, EmitContext*)
(dependencyobject.cpp:1154)
==20940==    by 0x10E76347: EventObject::Emit(int, EventArgs*, bool, int)
(dependencyobject.cpp:1024)
==20940==    by 0x10F977C1: TimeManager::SourceTick() (timemanager.cpp:438)
==20940==    by 0x10F96CD3: TimeManager::source_tick_callback(EventObject*,
EventArgs*, void*) (timemanager.cpp:170)
==20940==    by 0x10E768BB: EventObject::DoEmitCurrentContext(int,
EventArgs*) (dependencyobject.cpp:1121)
==20940==    by 0x10E76709: EventObject::DoEmit(int, EventArgs*)
(dependencyobject.cpp:1086)
==20940==    by 0x10E7632E: EventObject::Emit(int, EventArgs*, bool, int)
(dependencyobject.cpp:1022)
==20940==    by 0x10F98782: SystemTimeSource::tick_timeout(void*)
(timesource.cpp:164)
==20940==    by 0x61B7B8E: g_timeout_dispatch (gmain.c:3396)
==20940==    by 0x61B74C1: g_main_context_dispatch (gmain.c:1960)


you need to apply this patch:

diff --git a/mono/io-layer/wthreads.c b/mono/io-layer/wthreads.c
index 480db8c..4428ccb 100644
--- a/mono/io-layer/wthreads.c
+++ b/mono/io-layer/wthreads.c
@@ -248,8 +248,8 @@ static void *thread_start_routine (gpointer args)
        struct _WapiHandle_thread *thread = (struct _WapiHandle_thread
*)args;
        int thr_ret;
        
-       thr_ret = pthread_detach (pthread_self ());
-       g_assert (thr_ret == 0);
+       //thr_ret = pthread_detach (pthread_self ());
+       //g_assert (thr_ret == 0);
 
        thr_ret = pthread_setspecific (thread_hash_key,
                                       (void *)thread->handle);

Rolf



More information about the Moonlight-list mailing list