-
Notifications
You must be signed in to change notification settings - Fork 31
Add address file written after startup to eliminate port probing race condition #2908
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
Conversation
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
Copilot
AI
changed the title
[WIP] Add address file generation after startup
Add address file written after startup to eliminate port probing race condition
Dec 20, 2025
bbockelm
reviewed
Dec 20, 2025
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
49c628e to
7e978b3
Compare
558b964 to
e7bc72b
Compare
Co-authored-by: bbockelm <[email protected]>
The success of some of the `config_test.go` functions relied on global state; if any test ran before them and reset the config, they would fail. When `TestAddressConfig` was added, it went first and triggered that exact condition. This moves the setup into a standalone helper function which is executed only by tests that need it.
e7bc72b to
7aa82d3
Compare
2f665cb to
8befa92
Compare
8befa92 to
fc09b45
Compare
Collaborator
|
Another set of race condition bugs bite the dust! More reliable tests = happier developers. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
infrastructure
GitHub Actions, Release management, and CI
internal
Internal code improvements, not user-facing
test
Improvements to the test suite
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.
Test scripts that probe for open ports and hardcode them into config suffer from a race condition: concurrent tests may grab those ports between probing and server startup, causing failures.
Changes
Core Implementation
config/address_file.gowithWriteAddressFile()that atomically writes address file to the runtime directory after all services start and health checks pass/run/pelican/pelican.addressesXDG_RUNTIME_DIR:$XDG_RUNTIME_DIR/pelican/pelican.addressesXDG_RUNTIME_DIR: Falls back to${ConfigDir}/pelican.addressesKEY=VALUEpairs:SERVER_EXTERNAL_WEB_URL,ORIGIN_URL(if enabled),CACHE_URL(if enabled)0600(owner read/write only)launchers/launcher.goafterWaitUntilWorking()completesTest Script Update
github_scripts/stat_test.shnow uses--port 0to bind random portsExample
Address file appears only when server is fully operational, eliminating the window for race conditions. The file is properly placed in the runtime directory hierarchy, not the config directory, as it contains mutable runtime state.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.