Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionResetError Supression Regression in 3.7.x #5212

Closed
shauneccles opened this issue Nov 9, 2020 · 3 comments
Closed

ConnectionResetError Supression Regression in 3.7.x #5212

shauneccles opened this issue Nov 9, 2020 · 3 comments
Labels
bug needs-info Issue is lacking sufficient information and will be closed if not provided Stale

Comments

@shauneccles
Copy link

🐞 Describe the bug
Appears to be a regression in 3.7 branch that no longer supresses the connectionreset errors fixed by this commit
#3699

💡 To Reproduce

Using 3.7.x and python3.8 initiate an aiohttp listen server.
Present dynamic content.
Exit browser.

💡 Expected behaviour

ConnectionResetError: Cannot write to closing transport error is suppressed.

📋 Logs/tracebacks

[2020-11-09 10:49:12] ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\web_app.py", line 499, in _handle
    resp = await handler(request)
  File "c:\users\shaun\ledfx-3.8\ledfx\ledfx\api\__init__.py", line 26, in handler
    return await method(**{arg_name: available_args[arg_name] for arg_name in wanted_args})
  File "c:\users\shaun\ledfx-3.8\ledfx\ledfx\api\websocket.py", line 34, in get
    return await WebsocketConnection(self._ledfx).handle(request)
  File "c:\users\shaun\ledfx-3.8\ledfx\ledfx\api\websocket.py", line 157, in handle
    await self._sender_task
  File "c:\users\shaun\ledfx-3.8\ledfx\ledfx\api\websocket.py", line 98, in _sender
    await self._socket.send_json(message, dumps=json.dumps)
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\web_ws.py", line 316, in send_json
    await self.send_str(dumps(data), compress=compress)
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\web_ws.py", line 300, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\http_websocket.py", line 687, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "C:\Users\shaun\ledfx-3.8\lib\site-packages\aiohttp\http_websocket.py", line 598, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Stopping LedFx.
(ledfx-3.8) PS C:\Users\shaun\ledfx-3.8\LedFx> python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiohttp
>>> print(aiohttp.__version__)
3.7.2

📋 Your version of the Python

$ python --version
Python 3.8.0

📋 Your version of the aiohttp/yarl/multidict distributions

$ python -m pip show aiohttp
Bug in
Version: 3.7.2
Working in
Version: 3.6.3
$ python -m pip show multidict
Bug in
Version: 5.0.0
Working in
Version: 4.7.6
$ python -m pip show yarl
Bug in
Version: 1.6.0
Working in
Version: 1.5.1

📋 Additional context

Windows 10, aiohttp version 3.7 release branch (from 3.7.0 to latest)

@shauneccles shauneccles added the bug label Nov 9, 2020
@asvetlov
Copy link
Member

asvetlov commented Nov 9, 2020

I think the behavior is technically still ok (cannot write to the closed socket, terminate the web-handler).
I also agree that traceback in logs can scare.
Just logging the fact that a peer has dropped connection should be enough.

@shauneccles
Copy link
Author

shauneccles commented Nov 9, 2020

Investigating a bit further, this commit 21b0621 might be the culprit.

At line 470 it captures errors and funnels them to a debug log to ignore client disconnections.

except (asyncio.CancelledError, ConnectionError):

self.log_debug('Ignored premature client disconnection')

Would

except (asyncio.CancelledError, ConnectionError, ConnectionResetError):

self.log_debug('Ignored premature client disconnection')

Fix this?

@Dreamsorcerer
Copy link
Member

Is there an actual reproducer? It's not too clear what's wrong here.

@Dreamsorcerer Dreamsorcerer added the needs-info Issue is lacking sufficient information and will be closed if not provided label Aug 24, 2024
@github-actions github-actions bot added the Stale label Sep 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-info Issue is lacking sufficient information and will be closed if not provided Stale
Projects
None yet
Development

No branches or pull requests

3 participants