Skip to content

fix(octo): don't log ERROR when lease renewal is cancelled on purpose#27

Merged
lml2468 merged 1 commit into
mainfrom
fix/octo-hub-benign-renew-cancel
Jun 12, 2026
Merged

fix(octo): don't log ERROR when lease renewal is cancelled on purpose#27
lml2468 merged 1 commit into
mainfrom
fix/octo-hub-benign-renew-cancel

Conversation

@lml2468

@lml2468 lml2468 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

Observed in the live deployment after the reconfigure-restart fix (#22): when the hub cancels a supervisor (reconfigure or shutdown), the renew ticker can race ahead of the ctx.Done branch, so acquireLease returns context.Canceled and gets logged at ERROR

ERR octo hub: renew lease failed installation=... err="context canceled"

— with a redundant cancelRun(). Alarming noise for an entirely expected, benign event.

Fix

Guard with isBenignRenewCancel(ctx, err): when the run context is already done or the error is context.Canceled, return quietly (no ERROR log, no redundant cancel). A real DB failure on a live context still logs at ERROR and cancels the run as before.

Test

TestIsBenignRenewCancel — benign for cancelled-ctx and for a context.Canceled error; not benign for a real DB error on a live context. go vet + go test -race clean.

Follow-up polish to the Octo audit fixes — cosmetic log-level only, no behavior change to lease handling.

When the hub restarts a supervisor (reconfigure) or shuts down, the run
context is cancelled. If the renew ticker raced ahead of the ctx.Done
branch, acquireLease returned context.Canceled and was logged at ERROR
('octo hub: renew lease failed ... context canceled') with a redundant
cancelRun — alarming noise for an entirely expected, benign event.

Guard with isBenignRenewCancel(ctx, err): when the context is already
done or the error is context.Canceled, return quietly (no ERROR, no
redundant cancel). Real DB failures on a live context still log + cancel.

Test: isBenignRenewCancel is benign for cancelled-ctx / context.Canceled
and not for a real DB error on a live context.
@lml2468 lml2468 merged commit 61d2956 into main Jun 12, 2026
4 checks passed
@lml2468 lml2468 deleted the fix/octo-hub-benign-renew-cancel branch June 12, 2026 00:28
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