Re: [Evolution-hackers] Is this a locking bug?



Zan Lynx wrote:

>I think I found a locking bug in e-util/e-memory.c.  This bug, if it is
>this bug, has been crashing Evolution on me several times a day when
>running on a SMP system.  I patched it, and Evolution hasn't crashed
>yet, so I'm posting it.
>
>I'm not sure if the lock needs to include the e_mempool_flush or not.  I
>just tried to follow the locking in e_mempool_new.
>
>This is Evolution 1.4.5, compiled on Gentoo.  
>
>Here is the patch:
>--- /tmp/e-memory.c	2003-12-29 00:07:18.691690575 -0700
>+++ e-util/e-memory.c	2003-12-28 22:05:51.000000000 -0700
>@@ -534,10 +534,16 @@
>  **/
> void e_mempool_destroy(MemPool *pool)
> {
>+#ifdef G_THREADS_ENABLED
>+	g_static_mutex_lock(&mempool_mutex);
>+#endif
> 	if (pool) {
> 		e_mempool_flush(pool, 1);
> 		e_memchunk_free(mempool_memchunk, pool);
> 	}
>+#ifdef G_THREADS_ENABLED
>+	g_static_mutex_unlock(&mempool_mutex);
>+#endif
> }
>
>  
>
I think this is the wrong way to do it. The locking should probably be 
done inside e_mempool_flush() and from the looks of things, there will 
also need to be locking done in e_mempool_alloc().

might also need to lock in the memchunk code appropriately.

this may require a more complicated solution - such as a lock on each 
memchunk?

but before we get carried away, mind submitting a backtrace?

thanks

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]