aiorpc
aiorpc copied to clipboard
Logs Filled with 'Timeout when _send_error 'NoneType' object has no attr...'
I have been trying this library out, and it seems perfect for what we need.
However, whenever a client calls any function on the servers the logs are filled with the following error:
ERROR:aiorpc.aiorpc.server:Exception object of type 'NoneType' has no len() raised when _parse_request None
2018-05-23 15:26:14,108 aiorpc.aiorpc.server ERROR Timeout when _send_error 'NoneType' object has no attribute '__call__' to ('127.0.0.1', 62243)
ERROR:aiorpc.aiorpc.server:Timeout when _send_error 'NoneType' object has no attribute '__call__' to ('127.0.0.1', 62243)
I get many of those entries every second.
Any idea what's wrong?
Could you please try to change https://github.com/choleraehyq/aiorpc/blob/master/aiorpc/log.py#L10 to set log level to DEBUG to print more logs?
Or can you upload a example for me to reproduce this error?
Can confirm, using examples in the readme. Here is the log with DEBUG level: https://pastebin.com/YXG8EqWd
Python 3.6.5 aiorpc 0.1.3 uvloop 0.9.1 msgpack-python 0.5.6
Sorry for my late response. It seems there's something wrong with serialization or deserialization, as the first abnormal log is
2018-06-10 13:19:43,754 aiorpc.aiorpc.connection DEBUG sending raw_req b'\x94\x01\xff\xb0Invalid protocol\xc0' to ('127.0.0.1', 37432)
But I cannot reproduce this error in my own environment.
Part of the error messages seemed to be coming out of the flow handling in the server method where the iteration in the loop with a bad request received isn't skipped to start receiving a new request which could be possibly better formed. Put in a pull request #3 to improve the flow handling on erroneous request
Hi! I've got same issue when making call from Django view function to server. Don't forget to close the loop on client after client.close()!!
def make_request(request):
loop = uvloop.new_event_loop()
asyncio.set_event_loop(loop)
client = RPCClient('127.0.0.1', 6000, timeout=10)
try:
result = loop.run_until_complete(do(client))
finally:
client.close()
loop.close()
return HttpResponse(result)