fix: reject overlapping binary upgrades - #278
Draft
cookerpapa wants to merge 1 commit into
Draft
cookerpapa wants to merge 1 commit into
cookerpapa wants to merge 1 commit into
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have you on file. In order for us to review and merge your code, please contact @crawshaw at david@bold.dev to get yourself added. |
Contributor
|
Hi! This seems fine but we need a CLA signed. I think you can now do it online at https://shelley-cla.exe.xyz |
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.
Fixes #238.
Manual and automatic upgrades call the same
VersionChecker.DoUpgrademethod, but nothing prevents two calls from downloading and replacing the binary concurrently. Both replacement paths use fixed temporary/backup names.Add a dedicated upgrade mutex and reject overlapping calls with
upgrade already in progress. Hold the guard for the entire attempt, including the permission fallback, and release it on every return so failed attempts can be retried. Keep version-cache locking separate.Add two deterministic HTTP regression cases that overlap requests during checksum retrieval and binary download. They also verify that cached version checks still work and that an attempt can be retried after failure. Coordination uses channels, with no sleeps.
Validation on Linux / Go 1.27.1:
go test ./server -run '^TestDoUpgrade'passes, as does the same selection with-race.go build -o bin/shelley ./cmd/shelleypass.go test ./serverrun stops in terminal initialization because this environment lacks/proc/self/exe. The same failure reproduces with unchanged production code inTestBtwSlashHookRouting; full-suite validation remains pending.The regression server deliberately fails downloads before binary replacement. No installed binary was upgraded or removed.