Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/8875.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an unclosed transport ``ResourceWarning`` on web handlers -- by :user:`Dreamsorcerer`.
8 changes: 2 additions & 6 deletions aiohttp/web_protocol.py
Comment thread
Dreamsorcerer marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,12 @@ def connection_lost(self, exc: Optional[BaseException]) -> None:
return
self._manager.connection_lost(self, exc)

super().connection_lost(exc)
Comment thread
bdraco marked this conversation as resolved.

# Grab value before setting _manager to None.
handler_cancellation = self._manager.handler_cancellation

self.force_close()
super().connection_lost(exc)
self._manager = None
self._force_close = True
self._request_factory = None
self._request_handler = None
self._request_parser = None
Expand All @@ -349,9 +348,6 @@ def connection_lost(self, exc: Optional[BaseException]) -> None:
exc = ConnectionResetError("Connection lost")
self._current_request._cancel(exc)

if self._waiter is not None:
self._waiter.cancel()

if handler_cancellation and self._task_handler is not None:
self._task_handler.cancel()

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ addopts =
filterwarnings =
error
ignore:module 'ssl' has no attribute 'OP_NO_COMPRESSION'. The Python interpreter is compiled against OpenSSL < 1.0.0. Ref. https.//docs.python.org/3/library/ssl.html#ssl.OP_NO_COMPRESSION:UserWarning
ignore:unclosed transport <asyncio.sslproto._SSLProtocolTransport object.*:ResourceWarning
ignore:unclosed transport <_ProactorSocketTransport closing fd=-1>:ResourceWarning
ignore:Unclosed client session <aiohttp.client.ClientSession object at 0x:ResourceWarning
ignore:The loop argument is deprecated:DeprecationWarning:asyncio
ignore:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning::
Expand Down