Repository navigation
Conversation
This change replaces the previous method of picking a port number at random to try to start servers on, then retrying up to ten times with new random numbers each time, with a function that creates a server socket on port zero, thereby getting a suitable random port set by the kernel. That server socket is then closed and that port number is used to setup the actual test server on. There is a risk that *another* server can be started on the machine in the time gap, but the server verification feature will detect that.
dfandrich
reviewed
May 29, 2023
dfandrich
reviewed
May 29, 2023
dfandrich
left a comment
Contributor
There was a problem hiding this comment.
This should definitely help with reliable test server startup, especially in a free port starvation situation. If all the test servers actually start with this PR, then we can assume that they are all already setting SO_REUSEADDR and therefore need no further change to that effect.
Some points that I noticed while reviewing:
- $serverstartretries can be deleted
- %usedports can be deleted
Contributor
|
The first return value must be nonzero to mean error. e.g. 0+!$http2pid is 0 on
success (when $http2pid contains a PID) and 1 on error (when $http2pid is
zero). That's going to cause startservers() the return the wrong value on error.
I had to refactor startservers() in f82a38e to return a fine-grained error
in order to preserve the right behaviour after other refactoring.
|
bch
pushed a commit
to bch/curl
that referenced
this pull request
Jul 19, 2023
This change replaces the previous method of picking a port number at random to try to start servers on, then retrying up to ten times with new random numbers each time, with a function that creates a server socket on port zero, thereby getting a suitable random port set by the kernel. That server socket is then closed and that port number is used to setup the actual test server on. There is a risk that *another* server can be started on the machine in the time gap, but the server verification feature will detect that. Closes curl#11220
ptitSeb
pushed a commit
to wasix-org/curl
that referenced
this pull request
Sep 25, 2023
This change replaces the previous method of picking a port number at random to try to start servers on, then retrying up to ten times with new random numbers each time, with a function that creates a server socket on port zero, thereby getting a suitable random port set by the kernel. That server socket is then closed and that port number is used to setup the actual test server on. There is a risk that *another* server can be started on the machine in the time gap, but the server verification feature will detect that. Closes curl#11220
samueloph
added a commit
to Debian/curl
that referenced
this pull request
Mar 9, 2025
Its usage was dropped at 4efa0b5 (curl#11220) Grepping the tests folder for "portrange" returns only this as a result.
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
Its usage was dropped at 4efa0b5 (curl#11220) Grepping the tests folder for "portrange" returns only this as a result. Closes curl#16632
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change replaces the previous method of picking a port number at random to try to start servers on, then retrying up to ten times with new random numbers each time, with a function that creates a server socket on port zero, thereby getting a suitable random port set by the kernel. That server socket is then closed and that port number is used to setup the actual test server on.
There is a risk that another server can be started on the machine in the time gap, but the server verification feature will detect that.