-
Notifications
You must be signed in to change notification settings - Fork 216
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
get-free-port: prevent duplicate ports on Linux #1478
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but let @Quinn-With-Two-Ns confirm
testsuite/freeport.go
Outdated
// Modified from Temporalite which itself modified from | ||
// https://github.com/phayes/freeport/blob/95f893ade6f232a5f1511d61735d89b1ae2df543/freeport.go | ||
// Copied and adapted from | ||
// https://github.com/mjameswh/temporalio-cli/blob/6b5a708e51da89dbdfd4fda7b7219ae12bcd8ffb/temporalcli/devserver/freeport.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can point to PR instead of personal repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Fixed.
testsuite/freeport.go
Outdated
if err != nil { | ||
return "", 0, err | ||
return "", 0, fmt.Errorf("failed to assign a free port: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "", 0, fmt.Errorf("failed to assign a free port: %v", err) | |
return "", 0, fmt.Errorf("failed to assign a free port: %w", err) |
nit
What changed
TIME_WAIT
state. This avoids various race conditions that could happen due to the port being reallocated between the moment the port is obtained and the moment the server actually binds to that port. See get-free-port: prevent duplicate ports on Linux cli#564 for details.