Unhandled exception ConnectionResetError: Cannot write to closing transport
Closed this issue · 3 comments
doh-httpproxy running on 9f943a4
we got this in the logs:
ERROR: Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_protocol.py", line 447, in start
await resp.prepare(request)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_response.py", line 353, in prepare
return await self._start(request)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_response.py", line 667, in _start
return await super()._start(request)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_response.py", line 410, in _start
await writer.write_headers(status_line, headers)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/http_writer.py", line 112, in write_headers
self._write(buf)
File "/usr/local/lib/python3.7/dist-packages/aiohttp/http_writer.py", line 67, in _write
raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
Can you confirm that this is just a logging cosmetic issue and does not prevent the proxy from working correctly?
yes, I think so
What http proxy is running in front of DoH-proxy (e.g nginx for instance)?
nginx
What is the relevant config of the http proxy?
it matches more or less your guide here:
https://facebookexperimental.github.io/doh-proxy/tutorials/nginx-dohhttpproxy-unbound-centos7.html
Anything specific that triggers this error? Like slow recursive query, or a restart of the http proxy for instance?
I don't know, but nginx did not restart at the time of the error log.
This error did only show up once in the logs.
I'll keep an eye on it and let you know should it happen again.
the error is raised here:
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/http_writer.py#L67
Basically when we try to write data back to the HTTP client, the transport had already been closed.
At this stage there is nothing really actionable, and I don't think it is worth hiding the exception. We could spray the code with checks whether the transport is not in closing state but I dont think it is worth it.
I will close this issue for now, if this was becoming a real issue, please open a new issue.