[Vortex] closing a channel in the on_channel_created callback

dexter dexter at koli.kando.hu
Tue Mar 18 11:55:03 CET 2008


Hi,

I was wondering if it is allowed to close the channel right in the 
on_channel_created callback. If it is, then maybe there's a race cond 
somewhere, because my program sometimes (not always) segfaults, here's 
the backtrace:

#0  0xb6dfe550 in pthread_mutex_lock () from 
/lib/tls/i686/cmov/libpthread.so.0
#1  0xb6fce9f1 in vortex_mutex_lock (mutex_def=0x7854) at 
vortex_thread.c:297
#2  0xb6fbf22c in vortex_hash_lookup (hash_table=0x1, key=0xb6fd4d6d) at 
vortex_hash.c:248
#3  0xb6fb5b5f in vortex_channel_get_data (channel=0x80d81e8, 
key=0xb6fd4d6d) at vortex_channel.c:3200
#4  0xb6fb5dbb in vortex_channel_have_piggyback (channel=0x80d81e8) at 
vortex_channel.c:5935
#5  0xb6fba892 in __vortex_channel_new (data=0x80d84b8) at 
vortex_channel.c:867
#6  0xb6fc0eed in __vortex_thread_pool_dispatcher (data=0x80c00b8) at 
vortex_thread_pool.c:101
#7  0xb6dfc46b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8  0xb6bbd6de in clone () from /lib/tls/i686/cmov/libc.so.6

as we can see the hash_table (channel->data) has already been freed, but 
it is not NULL so in vortex_hash_lookup checking hash_table against NULL 
is no use.

But.. if it is not allowed to close channel in that callback, how can I 
do that? Because I don't need that channel anymore, I was just using 
this vortex_channel_new to check if the connection is still alive, so 
when I got the channel I know that the connection is ok, and I just 
close it.



More information about the Vortex mailing list