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

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

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
@cpython-cla-bot
Copy link

cpython-cla-bot bot 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 <ross.burton@arm.com>
@gpshead gpshead merged commit df11012 into python:main Aug 25, 2022
14 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Aug 25, 2022

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 <ross.burton@arm.com>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <ross.burton@arm.com>
@bedevere-bot
Copy link

bedevere-bot commented Aug 25, 2022

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 <ross.burton@arm.com>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <ross.burton@arm.com>
@bedevere-bot
Copy link

bedevere-bot commented Aug 25, 2022

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

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 <ross.burton@arm.com>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <ross.burton@arm.com>
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 <ross.burton@arm.com>
(cherry picked from commit df11012)

Co-authored-by: Ross Burton <ross.burton@arm.com>
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.

None yet

4 participants