crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 274 forks source link

'NoneType' object has no attribute 'writeHeaders' #1544

Open mtrofimm opened 5 years ago

mtrofimm commented 5 years ago

version: docker crossbario/crossbar:cpy3-18.11.2. in router logs I get:

 2019-03-26T14:45:22+0000 [Router         12] Unhandled error in Deferred:
2019-03-26T14:45:22+0000 [Router         12] 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/autobahn/wamp/protocol.py", line 1110, in onMessage
    txaio.reject(on_reply, self._exception_from_message(msg))
  File "/usr/local/lib/python3.7/site-packages/txaio/tx.py", line 478, in reject
    future.errback(error)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python3.7/site-packages/crossbar/bridge/rest/caller.py", line 90, in on_call_error
    log_category="AR458")
  File "/usr/local/lib/python3.7/site-packages/crossbar/bridge/rest/common.py", line 206, in _fail_request
    request.write(body)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/server.py", line 238, in write
    http.Request.write(self, data)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/http.py", line 1122, in write
    self.channel.writeHeaders(version, code, reason, headers)
builtins.AttributeError: 'NoneType' object has no attribute 'writeHeaders' 
om26er commented 5 years ago

@mtrofimm The latest crossbar is cpy3-19.3.5, could you please pull our latest docker images and see if the issue still happens for you ?

mtrofimm commented 5 years ago

@om26er is cpy3-19.3.5 server compatible with python client: crossbario/autobahn-python:cpy3-minimal-aio-18.11.2 ?

oberstet commented 5 years ago

@mtrofimm yes, those are compatible

mtrofimm commented 5 years ago

with cpy3-19.3.5 simillar callstack occurs from time to time.

  2019-03-27T15:16:44+0000 [Router         11] Unhandled error in Deferred:
2019-03-27T15:16:44+0000 [Router         11] 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/autobahn/wamp/protocol.py", line 888, in onMessage
    txaio.resolve(on_reply, msg.args[0])
  File "/usr/local/lib/python3.7/site-packages/txaio/tx.py", line 468, in resolve
    future.callback(result)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 460, in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python3.7/site-packages/crossbar/bridge/rest/caller.py", line 83, in on_call_ok
    log_category="AR202")
  File "/usr/local/lib/python3.7/site-packages/crossbar/bridge/rest/common.py", line 213, in _complete_request
    request.write(body)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/server.py", line 238, in write
    http.Request.write(self, data)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/http.py", line 1122, in write
    self.channel.writeHeaders(version, code, reason, headers)
builtins.AttributeError: 'NoneType' object has no attribute 'writeHeaders'
mtrofimm commented 5 years ago

I enabled debug logging on the client side, and found our the following error:

2019-04-01T13:46:18 failing connection: 1009: message exceeds payload limit of 1048576 octets
2019-04-01T13:46:18 connection closed properly: canceling closing handshake timeout
2019-04-01T13:46:18 _connectionLost: None
2019-04-01T13:46:18 serverConnectionDropTimeoutCall.cancel
2019-04-01T13:46:18 Auto ping/pong: canceling autoPingPendingCall upon lost connection
2019-04-01T13:46:18 WAMP-over-WebSocket transport lost: wasClean=True, code=1000, reason="None"
2019-04-01T13:46:18 session closed with reason wamp.close.transport_lost [WAMP transport was lost without closing the session before]
mtrofimm commented 5 years ago

I want to process such a big messages. How can I reconfigure WAMP server and/or client to avoid such errors?

oberstet commented 5 years ago

With Crossbar.io as a WAMP router, you can configure max message and max frame size like this: https://crossbar.io/docs/WebSocket-Options/#available-options

mtrofimm commented 5 years ago

my current config is:

                                    "max_frame_size": 21048576,
                                    "max_message_size": 21048576,
                                    "auto_fragment_size": 65536,

Here you can find https://github.com/crossbario/autobahn-python/issues/888#issuecomment-478609774 a suggested a workaround. What do you think?