[Vortex] Race condition in channel opening
Jens Alfke
jens at mooseyard.com
Tue Mar 18 02:00:15 CET 2008
I'm having an intermittent problem where, right after a connection
opens, the initiator gets a critical error "received a frame referring
to a non-opened channel", and closes the connection.
Looking over the logs of both sides, it seems to be a race condition
where the initiator opens a channel, the other side sends a message
over the channel as soon as it hears the open request, and then the
initiator gets that message before it gets the response to the open-
channel request. At that point the channel hasn't been registered yet,
so the incoming message can't be routed.
The sequence looks like:
1. Initiator requests a new channel (gets assigned #3)
2. Vortex sends the open-channel request over channel 0.
3. The other peer (the listener) receives open-channel request.
4. Listener sends response to open-channel request.
5. Application code on the listener side gets notified of the new
channel, decides it's now safe to send messages, so it sends one over
channel 3.
6. Initiator side receives the incoming message on channel 3.
7. Initiator looks up channel 3 in the connection's "channels"
dictionary, can't find it, fails.
I haven't looked at the bits going over the wire, so I don't know
whether the mistake is made on the listener side (sending the
channel-3 MSG over the socket before the channel-0 RPY) or on the
initiator side (receiving the messages in the right order but trying
to handle the MSG before the RPY.) In either case this seems to be a
bug in Vortex itself. By the time this happens, the connection's been
properly set up on both sides, so they should both be able to send
messages whenever they want, right?
—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://lists.aspl.es/pipermail/vortex/attachments/20080317/744419ae/attachment.bin
More information about the Vortex
mailing list