Skip to content

fix(taskpool): retry OpenQueue through queue-creation consistency window (#70) - #464

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/70-openqueue-consistency-retry
Jul 31, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/70-openqueue-consistency-retry

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Found in a real-AWS re-smoke of the pool (after v0.96.1's spored-bootstrap fix let workers boot far enough to expose it).

Symptom

Workers booted, installed spored fine (v0.96.1 retry fix worked — "✅ Checksum verified"), but the queue stayed at "4 waiting" and no task ran. SSM into a worker showed cloud-init failed with:

Error: open pool queue: resolve queue spawn-pool-<run>: ... AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist

…seconds after boot — even though the queue did exist (the submitter created it and pool status saw it).

Root cause

taskpool.OpenQueue did a single GetQueueUrl. That call is eventually consistent after the submitter's CreateQueue, so a fast-booting worker races the create and gets NonExistentQueue. The worker runs spored pool-worker once at boot, so an error there = it exits and never pulls.

Fix

OpenQueue now retries NonExistentQueue through the consistency window (10 × ~3s, bounded; matched via smithy API error code, not message text). Any other error (auth/throttle/malformed) still fails fast. A queue that never appears within the budget returns an error (fails loud, not silent).

Tests: TestOpenQueue_RetriesNonExistentQueue (3 misses then resolves) and TestOpenQueue_GivesUpAfterBudget; retry delay is a test-shrinkable var. pkg/taskpool green under -race.

Known follow-up (not in this PR)

There's a deeper robustness point: spored pool-worker runs as a one-shot cloud-init invocation, so ANY early exit (not just this one) means the worker never restarts. This PR fixes the actual failure mode observed (the consistency race); making the worker a restart-on-exit service is a separate hardening I'll file as an issue rather than expand scope here.

Refs #70.

…tency window (#70)

A pool worker resolves its queue at boot; GetQueueUrl is eventually consistent
after CreateQueue, so a fast worker raced it, got NonExistentQueue, and exited
(workers run once at boot) — the pool never drained. Found in a real-AWS
re-smoke. OpenQueue now retries NonExistentQueue (bounded); other errors fail fast.
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/taskpool/queue.go 60.00% 11 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 815759d into main Jul 31, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/70-openqueue-consistency-retry branch July 31, 2026 04:57
scttfrdmn added a commit that referenced this pull request Jul 31, 2026
Fixed: taskpool.OpenQueue now retries the create->GetQueueUrl
consistency window so freshly booted pool workers no longer exit
at boot on NonExistentQueue (#70/#464).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant