Treat concurrent default-group creation as success - #6457
Open
lorenzozanee wants to merge 1 commit into
Open
Conversation
Concurrent thv startups racing the Exists-then-Create window in EnsureDefaultGroupExists exited with "group already exists: default" because the loser's ErrGroupAlreadyExists conflict was treated as a fatal startup error. The ensure path now treats that conflict as success: when another process created the default group first, the desired end state already holds. --help, -h and help are now informational commands, so printing help no longer triggers migrations or the container runtime check. CheckTHVBinaryAvailable now preserves stderr so startup failures are diagnosable. Fixes stacklok#6359 Signed-off-by: lorenzozanee <wyz0707@proton.me>
lorenzozanee
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
aponcedeleonch,
jhrozek,
rdimitrov and
reyortiz3
as code owners
August 28, 2026 18:58
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.
Summary
thvprocesses concurrently could fail withfailed to ensure default group exists: group already exists: defaultwhen the processes raced the Exists-then-Create window in the default-group startup migration. This is reproducible in the core E2E shard, which runs Ginkgo withPROCS=4.groups.ErrGroupAlreadyExistsas success: when another process created the default group first, the desired end state already holds. Explicitgroup createcalls (CLI and the API 409 response) still report the conflict.--help,-handhelpare now classified as informational commands, so printing help no longer triggers migrations or the container runtime check.CheckTHVBinaryAvailablenow includes stderr in its error so startup failures are diagnosable instead of being masked asthv binary not available.Fixes #6359
Type of change
Test plan
task test)task lint-fix)New
Test_EnsureDefaultGroupExistsConcurrentspawns 8 concurrent default-group migrations against a fresh shared store and requires all of them to succeed (it fails onmainwithgroup already exists: default). Manually verified: 10 rounds of 4 concurrentthvprocesses against a fresh shared XDG state directory all exit 0 (previously 6/10 rounds had at least one process fail), andthv --helpon a fresh directory exits 0 without creating the default group or requiring a container runtime.Does this introduce a user-facing change?
Yes. Concurrent
thvstartups that previously failed withgroup already exists: defaultnow succeed, andthv --helpno longer requires a container runtime or triggers migrations.