[Vortex] Bug? Channel iterators returning channels that aren't open yet

Francis Brosnan Blazquez francis at aspl.es
Wed Apr 9 12:06:22 CEST 2008

Hi Jens,

> I believe I'm running into a race condition in Vortex (current SVN),  
> where client code can open a channel asynchronously, and then using  
> vortex_connection_get_channel_by_func can find that VortexChannel  
> before it's been fully opened. If it sends a message over that  
> channel, the message can go over the socket before the channel's
> been  
> created, causing the remote peer to panic and abort the connection.

Does the asynchronous creation finished before starting to use the

> I'm definitely seeing an intermittent bug with that effect (one peer  
> complains about getting a message for a nonexistent channel). It  
> frustratingly goes away if I turn on full logging, but I'm seeing
> some  
> other results that strongly suggest that  
> vortex_connection_get_channel_by_func is showing me channels whose  
> VortexOnChannelCreated callbacks haven't been called yet.

...that's possible since the channel is added to the connection to avoid
race conditions with other running threads during its preparation.

The channel can't be used until the channel creation is accepted either
by a reference returned in blocking mode or by async notification
through VortexOnChannelCreated. I'll update docs to clearly report

> I'm about to change my code to stop iterating over the channel list,  
> since this behavior's causing other problems for me too; that should  
> work around the problem. But I wanted to note its existence so that
> it  
> could be fixed. Sorry I don't have a test case, but maybe my  
> description will be of help to an expert looking through the Vortex  
> code.

I think this is not a bug assuming previous context. In any case thanks
for reporting. Cheers!

> —Jens
Francis Brosnan Blazquez <francis at aspl.es>
Advanced Software Production Line, S.L.

More information about the Vortex mailing list