nasty bug in multithreaded g_main_loop...



Hi,

here's a deadlock due to a nonrecursive mutex, which is tried to be
obtained twice. The backtrace is below. I've looked in the code, but
haven't seen any good way to solve that yet, apart from doing tricks there
with an own implementation of a recursive mutex, we would only need to add
g_thread_self, which isn't much, but obviously a API-changel, so actually
not wanted (It is also possible to do it with thread private data, that
doesn't feel clean, though). However things can't remain like they are,
because thats simply a bug. It happens in my multithreaded ORBit-code,
where I use the glib main loop abstraction. It will be in CVS soon, if you
would like to see, where it is happening. It simply is, that a hook gets
removed and therefore, while holding the mutex the corresponding FD is
removed.

#4  0xef679ac0 in _mutex_lock ()
#5  0xef775bdc in g_main_remove_poll (fd=0x7a388) at gmain.c:761
#6  0xef77346c in g_io_unix_destroy (source_data=0x7a388) at giounix.c:134
#7  0xef7746e4 in g_source_free_func (hook_list=0xef799744, hook=0x7c488)
at gmain.c:246
#8  0xef77176c in g_hook_free (hook_list=0xef799744, hook=0x7c488) at
ghook.c:116
#9  0xef771b8c in g_hook_unref (hook_list=0xef799744, hook=0x7c488) at
ghook.c:188
#10 0xef774e90 in g_main_dispatch (current_time=0xef20bba8) at gmain.c:404
#11 0xef7753b4 in g_main_iterate (block=1144, dispatch=1) at gmain.c:573
#12 0xef775504 in g_main_run (loop=0x79dd8) at gmain.c:617


Bye,
Sebastian
-- 
Sebastian Wilhelmi                   |            här ovanför alla molnen
mailto:wilhelmi@ira.uka.de           |      är himmlen så förunerligt blå
http://goethe.ira.uka.de/~wilhelmi   |



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