Should ApplicationRunner.run() return after an connection opening handshake timeout?

#1

Hi,

I have a simple question about the Autobahn/Python ApplicationRunner() class. I’m currently using Autobahn Python 17.5.1 with Twisted.

If I get an error such as a WAMP ping/pong error after ApplicationRunner.run() has been called (i.e., the connection/session has been established and is running, the error causes onLeave and onDisconnect to fire and ApplicationRunner.run() returns as one would expect. The debug output shows:

2018-01-30T00:54:16+0000 Expecting ping in 5.0 seconds for auto-ping/pong
2018-01-30T00:54:21+0000 dropping connection to peer tcp4:127.0.0.1:80 with abort=True: WebSocket ping timeout (peer did not respond with pong in time)
2018-01-30T00:54:21+0000 Connection to/from tcp4:127.0.0.1:80 was aborted locally
2018-01-30T00:54:21+0000 _connectionLost: [Failure instance: Traceback (failure with no frames): <class ‘twisted.internet.error.ConnectionAborted’>: Connection was aborted locally, using.]
2018-01-30T00:54:21+0000 WAMP-over-WebSocket transport lost: wasClean=False, code=1006, reason=“connection was closed uncleanly (WebSocket ping timeout (peer did not respond with pong in time))”
2018-01-30T00:54:21+0000 Main loop terminated.
(onJoin and onDisconnect then called, Twisted reactor stopped, ApplicationRunner.run() returns)

My question is, after ApplicationRunner.run() is called, but an error happens during the opening handshake (or some other connection setup happens), should ApplicationRunner.run() return in that case as well? What I’m seeing is essentially a hang, even though the _connectionLost message appears again.

2018-01-30T00:54:29+0000 Connection made to tcp4:127.0.0.1:80
2018-01-30T00:54:32+0000 dropping connection to peer tcp4:127.0.0.1:80 with abort=True: WebSocket opening handshake timeout (peer did not finish the opening handshake in time)
2018-01-30T00:54:32+0000 Connection to/from tcp4:127.0.0.1:80 was aborted locally
2018-01-30T00:54:32+0000 _connectionLost: [Failure instance: Traceback (failure with no frames): <class ‘twisted.internet.error.ConnectionAborted’>: Connection was aborted locally, using.]

Since the error happens at connection setup, onConnect and onJoin never get called, and ApplicationRunner.run() never returns.

I understand I can increase the opening handshake timeout, but is ApplicationRunner.run() supposed to return if a timeout does happen?

Thanks very much for any information,
Dave

0 Likes

#2

I’ve seen rumblings elsewhere about using something other than ApplicationRunner (“Component”?) and I will look into that, as well as updating Autobahn.

That said, in the meantime, it seems like the ApplicationRunner.run() method probably should return if possible on connection lost/dropped errors. Is the answer: “We won’t fix it since we have other priorities and want you to use something else.”? ;^)

Dave

0 Likes