TCP connection periodically dropping for reasons unknown

300 views
Skip to first unread message

Steve Ditlinger

unread,
Mar 8, 2016, 4:13:45 PM3/8/16
to Crossbar

I have an external publisher using REST to publish to our Crossbar Router (0.12.1)
Many of the messages being published are rather large (> 1 MB ) XML strings and arrive with a frequency of 5-10 per second. 
I have written a simple twisted ApplicationRunner-based Python 2.7.4 subscriber client to monitor the messages that unfortunately intermittently drops the TCP connection. Sometimes this happens after 30+ minutes, sometimes within a minute. Unfortunately no combination of enabling the "debug" options on either router or subscriber client lends much diagnostic information as to why the connection was dropped.

1) Is there a way to better figure out why the connection keeps dropping?
2) Is there a way to initiate a reconnect when the connection does drop?

Error message, subscriber code, and router config for websocket follow.......

Thanks,
Steve


Here is the most detailed error message...
-----------------
2016-03-08T15:53:10-0500 Failing connection: 1002: RSV = 7 and no extension negotiated
2016-03-08T15:53:10-0500 dropping connection: I failed the WebSocket connection by dropping the TCP connection
2016-03-08T15:53:10-0500 Connection to/from tcp4:127.0.0.1:8080 was aborted locally
2016-03-08T15:53:10-0500 _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally, using.]
2016-03-08T15:53:10-0500 WAMP-over-WebSocket transport lost: wasClean=False, code=1006, reason="connection was closed uncleanly (I failed the WebSocket connection by dropping the TCP connection)"
2016-03-08T15:53:10-0500 disconnected
2016-03-08T15:53:10-0500 Main loop terminated.
---------------------

Here is the subscriber client....
--------------

from __future__ import print_function

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import auth
import datetime
import requests
import json

class Component(ApplicationSession):
    """
    An application component that subscribes and receives events
    """
   
    @inlineCallbacks
    def onJoin(self, details):
        print("session attached")
       
        def on_eventfd(i):
            print("FD " + i[0:25])
              
        sub = yield self.subscribe(on_eventfd, 'data.farmdata')

    def onConnect(self):
        print("connected")
        self.join(self.config.realm, [u"wampcra"], u"tester")
       
    def onChallenge(self, challenge):
        print("challenged")
        if challenge.method == u"wampcra":
            signature = auth.compute_wcs(u"testpassword".encode('utf8'),
                                      challenge.extra['challenge'].encode('utf8'))
            return signature.decode('ascii')
        else:
            raise Exception("don't know how to handle authmethod {}".format(challenge.method))

    def onDisconnect(self):
        print("disconnected")
        self.fileout.close()
        if reactor.running:
            reactor.stop()


if __name__ == '__main__':
    runner = ApplicationRunner(
        url=u"ws://localhost:8080/fds",
        realm=u"fds", debug=True, debug_app=True)
  
    runner.run(Component)
----------------------------------------------

Here is router config for websocket:
------------------------------------------------------
                        "fds" : {
                            "type" : "websocket",
                            "auth" : {
                                "wampcra" : {
                                    "type" : "dynamic",
                                    "authenticator" : "fds.loggerinner"
                                }
                            },
                            "options" : {
                                "echo_close_codereason" : true
                            },
                            "debug" : true
                        },
-----------------------------------------



David Ford

unread,
Mar 31, 2016, 9:17:19 AM3/31/16
to cross...@googlegroups.com
run crossbar with --loglevel debug. current releases of crossbar and autobahn are trying to collect all the logging controls in one place but there's still a few places it seems where tracebacks, warnings and etc., are getting completely lost

--
You received this message because you are subscribed to the Google Groups "Crossbar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crossbario+...@googlegroups.com.
To post to this group, send email to cross...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/crossbario/a4d6e38b-93e1-49cf-8ad3-2f9531271642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Gay/FireRescue/Geek in 33484, USA
It's the ideals of Linux and Open Source that are amazing, it embodies what WE want, not what is marketed
Reply all
Reply to author
Forward
0 new messages