Skip to content

Explain unexpected work recursion before logging fatally#289

Merged
glin merged 1 commit into
mainfrom
log-reason-before-fatal-recursion
Jul 17, 2026
Merged

Explain unexpected work recursion before logging fatally#289
glin merged 1 commit into
mainfrom
log-reason-before-fatal-recursion

Conversation

@glin

@glin glin commented Jul 16, 2026

Copy link
Copy Markdown
Member

Found while debugging a downstream product that exited with only Work with type 64 attempted recursion without being marked for recursion. The message names the work type but not why the process died or where the recursion came from, so locating the unmarked runner took an investigation that a stack trace would have answered immediately.

Changes in OptionallyRecurse:

  • Both log paths now state the cause and the fix: the work's context reached a nested queue operation without ContextWithExpectedRecursion, and the runner should mark its context.
  • The fatal path says the exit is caused by FatalRecurseCheck being enabled and includes debug.Stack() to locate the unmarked call chain.
  • No functional change: unmarked recursion still proceeds through r.Recurse as before.

Testing: go test ./pkg/rsqueue/queue/ passes. Log-output change only.

The unmarked-recursion message named only the work type, so a process killed
by FatalRecurseCheck gave no hint of why it exited or where the recursion
came from. State the cause and the fix (mark the context with
ContextWithExpectedRecursion) in both log paths, and include the stack in the
fatal path to locate the unmarked call chain.
@glin
glin requested review from a team, CDRayn and jstruzik and removed request for a team July 16, 2026 23:40
@glin
glin merged commit 5265921 into main Jul 17, 2026
1 check passed
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.

3 participants