twonds / punjab

BOSH connection manager
MIT License
183 stars 49 forks source link

[XmlStream,client] connect ERROR: Reason unknown #50

Closed bluszcz closed 8 years ago

bluszcz commented 10 years ago

Users being disconnected for "Reason unknown":

2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] HTTPB POST : 
2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] <body rid='2926047266' xmlns='http://jabber.org/protocol/httpbind' sid='e167924e5bada7983f4e8c4ac9b03ad64dd02e37
2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] 2926047266
2014-02-14 08:39:21+0000 [-] 

        RETURN HTTPB 1392367161.06:
2014-02-14 08:39:21+0000 [-] <body xmlns='http://jabber.org/protocol/httpbind'/>
2014-02-14 08:39:21+0000 [-] 2926047266
2014-02-14 08:39:21+0000 [-] Unhandled Error
        Traceback (most recent call last):
          File "/usr/local/lib/python2.6/dist-packages/punjab/session.py", line 109, in doCallback
            self.deferred.callback(data)
          File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 280, in callback
            self._startRunCallbacks(result)
          File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 354, in _startRunCallbacks
            self._runCallbacks()
          File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 371, in _runCallbacks
            self.result = callback(self.result, *args, **kw)
        --- <exception caught here> ---
          File "/usr/local/lib/python2.6/dist-packages/punjab/httpb.py", line 494, in return_error
            self.send_http_error(error.conditions[str(e.value)]['code'],
        exceptions.KeyError: 'Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.'

2014-02-14 08:40:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: ' '
2014-02-14 08:41:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: ' '
2014-02-14 08:41:13+0000 [-] SESSION -> Terminate
2014-02-14 08:41:13+0000 [-] expire (e167924e5bada7983f4e8c4ac9b03ad64dd02e37)
2014-02-14 08:41:13+0000 [-] 0
2014-02-14 08:41:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: '</stream:stream>'
2014-02-14 08:41:13+0000 [XmlStream,client] connect ERROR: Reason unknown
twonds commented 10 years ago

This means that the client connection was lost and that punjab attempted to close an already closed connection. Punjab should have not failed with a key error here so there is a bug.

But my guess is that you have a timeout of some kind in your proxy and the proxy closed the connection before Punjab could respond. Please check your proxy connection.

bluszcz commented 10 years ago

I changed timeout of proxy to 600s and it didn't help - I still experience same errors.

twonds commented 10 years ago

Can you replicate this in a test? The easiest thing may be to use tcpflow or tcpdump and watch the connection and see where it disconnects. There may be another reason for the proxy dropping the connection other than a timeout.