-
Notifications
You must be signed in to change notification settings - Fork 113
Fix "address already in use" from wwclient when secure=true #2010
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
Fix "address already in use" from wwclient when secure=true #2010
Conversation
|
Well, this doesn't appear to have fixed it yet. |
6057e96 to
6c66f37
Compare
wwclient --once686bf3e to
0b50a52
Compare
413d58a to
86c8499
Compare
46cea9d to
b768049
Compare
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.
Pull Request Overview
This PR fixes "address already in use" errors that occur when running wwclient with the --once option and secure=true. The issue was caused by HTTP response bodies not being properly closed and idle connections not being cleaned up on exit, leaving local ports in TIME_WAIT state.
- Added
defer resp.Body.Close()to properly close HTTP response bodies - Added
SO_REUSEADDRsocket option to allow immediate port reuse - Added connection cleanup in the
cleanUp()function to close idle connections on exit
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/app/wwclient/root.go | Adds socket options for port reuse, response body cleanup, and idle connection cleanup |
| CHANGELOG.md | Documents the fix for issue #2009 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
b768049 to
e55d177
Compare
- Closes: warewulf#2009 Signed-off-by: Jonathon Anderson <[email protected]>
e55d177 to
a4bde3b
Compare
|
Thanks for the review! |
Description of the Pull Request (PR):
In
updateSystem(),Webclient.Get()returns an HTTP response, but never callsresp.Body.Close(). When using --once option, the process exits quickly after the HTTP request, but the underlying TCP connection may not be properly closed. This leaves the local port in a TIME_WAIT state, causing subsequent runs to fail with "address already in use."In addition, connections in the pool were not being properly cleaned up on exit, and the connection was not told it was ok to re-use a recently-used port.
This fixes or addresses the following GitHub issues:
Reviewer checklist
The reviewer checks the following items before merging the PR.
git commit --signoff) in agreement to the DCO