Possible bug in crossbar router detach?

#1

Hi All,

I’m relatively new to github project contribution, so i’m posting my 2 cents here.

I have encountered a bug while using crossbar, here is the scenario.

Scenario:

  1. A’ calls registered funcs of B’ (this calls take some considerable amount of time)

  2. B goes down

  3. Crossbar receives good bye from B

  4. A goes down before crossbar notifies about caller error

  5. Crossbar execution will continue and will reach detach(): “transport.send”. an exception will raise because the socket was abruptly closed. (at step 4)

My fix:

Try catch the transport send call

attached patch.

Relevant code:

session.py:~485

elif isinstance(msg, message.Goodbye):

if not self._goodbye_sent:

The peer wants to close: answer with GOODBYE reply.

Note: We MUST NOT send any WAMP message after GOODBYE

reply = message.Goodbye()

self._transport.send(reply)

self._goodbye_sent = True

else:

This is the peer’s GOODBYE reply to our own earlier GOODBYE

pass

We need to first detach the session from the router before

erasing the session ID below …

try:

self._router.detach(self)

except Exception:

self.log.failure(“Internal error”)

dealer.py:~169

if session in self._session_to_registrations:

send out Errors for any in-flight calls we have

outstanding = self._callee_to_invocations.get(session, [])

for invoke in outstanding:

self.log.debug(

“Cancelling in-flight INVOKE with id={request} on”

" session {session}",

request=invoke.call.request,

session=session._session_id,

)

reply = message.Error(

message.Call.MESSAGE_TYPE,

invoke.call.request,

ApplicationError.CANCELED,

[u"callee disconnected from in-flight request"],

)

send this directly to the caller’s session

invoke.caller._transport.send(reply) <=========== Will throw an exception

Attached my patch.

Thanks,

Guy

fix-detach-cancel-in-flight.patch (817 Bytes)

0 Likes