Skip to content

gh-95243: Mitigate the race condition in testSockName #96173

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

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

rossburton
Copy link
Contributor

@rossburton rossburton commented Aug 22, 2022

find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting review labels Aug 22, 2022
@ghost
Copy link

ghost commented Aug 22, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@rossburton rossburton changed the title gn-95243: Mitigate the race condition in testSockName gh-95243: Mitigate the race condition in testSockName Aug 22, 2022
find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <[email protected]>
@gpshead gpshead added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Aug 25, 2022
@gpshead gpshead merged commit df11012 into python:main Aug 25, 2022
@miss-islington
Copy link
Contributor

Thanks @rossburton for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 25, 2022
…-96173)

find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <[email protected]>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Aug 25, 2022
@bedevere-bot
Copy link

GH-96256 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 25, 2022
…-96173)

find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <[email protected]>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <[email protected]>
@bedevere-bot
Copy link

GH-96257 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Aug 25, 2022
miss-islington added a commit that referenced this pull request Aug 25, 2022
find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <[email protected]>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <[email protected]>
miss-islington added a commit that referenced this pull request Aug 25, 2022
find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <[email protected]>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants