classification
Title: test_asyncio emits ResourceWarning warnings
Type: Stage: resolved
Components: asyncio Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2018-06-06 22:44 by vstinner, last changed 2018-06-07 14:20 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7460 merged vstinner, 2018-06-06 22:58
PR 7461 merged vstinner, 2018-06-06 23:03
PR 7478 merged vstinner, 2018-06-07 14:03
Messages (4)
msg318864 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-06 22:44
vstinner@apu$ ./python -X dev -u -m test test_asyncio -v 2>&1
(...)
test_create_connection_ssl_failed_certificate (test.test_asyncio.test_sslproto.SelectorStartTLSTests) ...

Exception in thread test-server:
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 263, in _run
    self._handle_client(conn)
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 272, in _handle_client
    self._prog(TestSocketWrapper(sock))
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/test_sslproto.py", line 604, in server
    server_side=True)
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 153, in start_tls
    ssl_sock.do_handshake()
  File "/home/vstinner/prog/python/master/Lib/ssl.py", line 1108, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 232, in run
    self._run()
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 269, in _run
    self._test._abort_socket_test(ex)
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py", line 122, in _abort_socket_test
    self.fail(ex)
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 680, in fail
    raise self.failureException(msg)
AssertionError: [Errno 0] Error

/home/vstinner/prog/python/master/Lib/threading.py:951: ResourceWarning: unclosed <ssl.SSLSocket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 53417), raddr=('127.0.0.1', 44022)>
  del exc_type, exc_value, exc_tb
ok

(...)

test_start_tls_client_corrupted_ssl (test.test_asyncio.test_sslproto.SelectorStartTLSTests) ...

/home/vstinner/prog/python/master/Lib/test/test_asyncio/functional.py:272: ResourceWarning: unclosed <socket.socket fd=13, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 46551), raddr=('127.0.0.1', 34620)>
  self._prog(TestSocketWrapper(sock))
/home/vstinner/prog/python/master/Lib/asyncio/sslproto.py:322: ResourceWarning: unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0x7f74c1ac6400>
  source=self)
ok

(...)


I'm working on a fix.
msg318865 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-06 23:12
New changeset 0eba7c39132614a5730cda6b340e18dfb2d30d14 by Victor Stinner in branch 'master':
bpo-33789: test_asyncio: Fix ResourceWarning (GH-7460)
https://github.com/python/cpython/commit/0eba7c39132614a5730cda6b340e18dfb2d30d14
msg318866 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-06 23:13
New changeset 7ed61e9431ee2c191aeeeb26f86a71bb90ab99fd by Victor Stinner in branch 'master':
bpo-33789, test_asyncio: Hide PendingDeprecationWarning (GH-7461)
https://github.com/python/cpython/commit/7ed61e9431ee2c191aeeeb26f86a71bb90ab99fd
msg318936 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-07 14:19
New changeset 3c417610ad318afecf471d59c53e5ae592740791 by Victor Stinner in branch '3.7':
[3.7] bpo-33789: Backport test_asyncio fixes from master (GH-7478)
https://github.com/python/cpython/commit/3c417610ad318afecf471d59c53e5ae592740791
History
Date User Action Args
2018-06-07 14:20:46vstinnersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.7
2018-06-07 14:19:03vstinnersetmessages: + msg318936
2018-06-07 14:03:56vstinnersetpull_requests: + pull_request7101
2018-06-07 13:49:26vstinnerlinkissue33743 superseder
2018-06-06 23:13:50vstinnersetmessages: + msg318866
2018-06-06 23:12:41vstinnersetmessages: + msg318865
2018-06-06 23:03:42vstinnersetpull_requests: + pull_request7084
2018-06-06 22:58:05vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request7083
2018-06-06 22:44:08vstinnercreate