Repository navigation
test_ssl: test_pha_required_nocert() emits a ResourceWarning #81503
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2021-09-21.22:24:43.818>
created_at = <Date 2019-06-17.20:35:34.826>
labels = ['3.8', 'tests', '3.9', '3.10', '3.11']
title = 'test_ssl: test_pha_required_nocert() emits a ResourceWarning'
updated_at = <Date 2021-09-21.22:24:43.818>
user = 'https://github.com/vstinner'bugs.python.org fields:
activity = <Date 2021-09-21.22:24:43.818>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2021-09-21.22:24:43.818>
closer = 'vstinner'
components = ['Tests']
creation = <Date 2019-06-17.20:35:34.826>
creator = 'vstinner'
dependencies = []
files = ['49294']
hgrepos = []
issue_num = 37322
keywords = ['patch']
message_count = 15.0
messages = ['345903', '347535', '347542', '347547', '347551', '347553', '347555', '347558', '372939', '372940', '391669', '391761', '392690', '392704', '402399']
nosy_count = 5.0
nosy_names = ['vstinner', 'christian.heimes', 'lukasz.langa', 'miss-islington', 'mhughes']
pr_nums = ['14662', '14665', '14667', '14669', '14670', '14673', '21393', '25553', '25572', '25573']
priority = 'high'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue37322'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir
Activity
vstinner commentedon Jun 17, 2019
Ran 1 test in 0.100s
OK
== Tests result: SUCCESS ==
1 test OK.
Total duration: 1 sec 430 ms
Tests result: SUCCESS
The test fails using -Werror.
vstinner commentedon Jul 9, 2019
I marked bpo-37525 as duplicate of this issue.
vstinner commentedon Jul 9, 2019
New changeset cf9c41c by Victor Stinner in branch 'master':
bpo-37322: Fix test_ssl.test_pha_required_nocert() ResourceWarning (GH-14662)
cf9c41c
vstinner commentedon Jul 9, 2019
Oh. This test started to fail on Windows with this change. Example:
https://buildbot.python.org/all/#/builders/3/builds/3121
ERROR: test_pha_required_nocert (test.test_ssl.TestPostHandshakeAuth)
----------------------------------------------------------------------
I proposed PR 14669 to revert it.
vstinner commentedon Jul 9, 2019
New changeset 61b1bc5 by Victor Stinner in branch 'master':
Revert "bpo-37322: Fix test_ssl.test_pha_required_nocert() ResourceWarning (GH-14662)" (GH-14669)
61b1bc5
vstinner commentedon Jul 9, 2019
The test also logs an "Exception in thread Thread-2:" error:
---
Ran 1 test in 0.028s
OK
== Tests result: SUCCESS ==
1 test OK.
Total duration: 179 ms
Tests result: SUCCESS
---
Attached PR 14670 makes this log quiet.
vstinner commentedon Jul 9, 2019
New changeset 73ea546 by Victor Stinner in branch 'master':
bpo-37322: ssl test_pha_required_nocert() ignores expected SSLError (GH-14670)
73ea546
miss-islington commentedon Jul 9, 2019
New changeset 4c403b8 by Miss Islington (bot) in branch '3.8':
bpo-37322: ssl test_pha_required_nocert() ignores expected SSLError (GH-14670)
4c403b8
matthewhughes934 commentedon Jul 3, 2020
I noticed this test was still emitting a "ResourceWarning":
----------------------------------------------------------------------
== Tests result: SUCCESS ==
1 test OK.
Total duration: 1.1 sec
Tests result: SUCCESS
----------------------------------------------------------------------
and thought I would try silencing it by ensuring the SSL connection handled by the separate thread was closed before exiting. My attempt involved checking the thread's exception and acting accordingly, but I ran into a race condition which (solely as a proof of concept) I resolved by adding a sleep() call (see patch).
While I continue to search for a proper resolution I was wondering what approach someone with more insight might suggest.
matthewhughes934 commentedon Jul 3, 2020
Whoops, I realise the patch I shared contained a combination of two (independent) approaches I tried:
tiran commentedon Apr 23, 2021
I wasn't aware of this bpo and created bpo-43885 a couple of days ago.
tl;dr I do not understand test changes in fb7e750 at all. I think that these changes are broken, too. ThreadedEchoServer and ConnectionHandler must not raise unhandled exceptions. An unhandled exception can break tests and sometimes causes threaded tests to hang indefinitely.
tiran commentedon Apr 24, 2021
New changeset c8666cf by Christian Heimes in branch 'master':
bpo-37322: Fix ResourceWarning and exception handling in test (GH-25553)
c8666cf
ambv commentedon May 2, 2021
I re-ran CI on the pull requests, the 3.8 and 3.9 failures on Windows X64 and macOS reproduced the same.
tiran commentedon May 2, 2021
I have cherry-picked e047239 into both backports and rebased them on top of upstream/3.8 and upstream/3.9.
vstinner commentedon Sep 21, 2021
ResourceWarning is no longer emitted. I close the issue.