PowerHub
PowerHub copied to clipboard
Twisted exceptions
This came already up in another issue but just to keep track of it, twisted occasionally throws exceptions, cluttering the output of PowerHub.
Unhandled Error
Traceback (most recent call last):
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/tcp.py", line 243, in doRead
return self._dataReceived(data)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/protocols/basic.py", line 579, in dataReceived
why = self.rawDataReceived(data)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/http.py", line 645, in rawDataReceived
self.handleResponsePart(data)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/proxy.py", line 77, in handleResponsePart
self.father.write(buffer)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/server.py", line 238, in write
http.Request.write(self, data)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/http.py", line 1118, in write
self.channel.writeHeaders(version, code, reason, headers)
builtins.AttributeError: 'NoneType' object has no attribute 'writeHeaders'
Unhandled Error
Traceback (most recent call last):
File "/home/user/Downloads/PowerHub/powerhub/reverseproxy.py", line 78, in run_proxy
reactor.run()
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/base.py", line 1272, in run
self.mainLoop()
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/base.py", line 1284, in mainLoop
self.doIteration(t)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/epollreactor.py", line 235, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- <exception caught here> ---
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/posixbase.py", line 627, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/posixbase.py", line 258, in _disconnectSelectable
selectable.connectionLost(failure.Failure(why))
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/tcp.py", line 519, in connectionLost
self._commonConnection.connectionLost(self, reason)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/internet/tcp.py", line 327, in connectionLost
protocol.connectionLost(reason)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/http.py", line 599, in connectionLost
self.handleResponseEnd()
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/proxy.py", line 87, in handleResponseEnd
self.father.finish()
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/server.py", line 249, in finish
return http.Request.finish(self)
File "/home/user/Downloads/PowerHub/venv/lib/python3.7/site-packages/twisted/web/http.py", line 1046, in finish
"Request.finish called on a request after its connection was lost; "
builtins.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.
I don't know why, but they're gone. I'm using twisted 20.3.0.
I think they only stopped because socket.io stopped working a while ago. The JavaScript lib became incompatible with the python lib.
Fixed in 2.0.0