Skip to content

fix: default max_consecutive_failures to 6 for Caddy workers - #2704

Merged
dunglas merged 1 commit into
mainfrom
fix/caddy-worker-max-failures-default
Oct 10, 2026
Merged

dunglas merged 1 commit into
mainfrom
fix/caddy-worker-max-failures-default

Conversation

@dunglas

@dunglas dunglas commented Oct 10, 2026

Copy link
Copy Markdown
Member

The docs and the field comment say max_consecutive_failures defaults to 6. However, toWorkerOptions() always passed wc.MaxConsecutiveFailures to WithWorkerMaxFailures(). When the directive is not set, its zero value overrode the default, so every Caddyfile or JSON worker aborted startup on its first boot failure instead of retrying with backoff.

The field is now a *int, the same way RequestBodyTimeout is handled. The option is only passed when the directive is set: the default applies when it is omitted, and an explicit 0 still means "no retries".

Found while investigating #2697. The new test fails on main with "too many consecutive failures" and passes with the fix.

toWorkerOptions always passed MaxConsecutiveFailures to
WithWorkerMaxFailures, so an unset value overrode the documented
default of 6 with 0 and any Caddyfile or JSON worker aborted startup
on its first boot failure. The field is now a pointer, so the default
applies when it is omitted and an explicit 0 still means no retries.
@dunglas
dunglas marked this pull request as ready for review October 10, 2026 06:16
@dunglas
dunglas merged commit 9e3a325 into main Oct 10, 2026
40 of 41 checks passed
@dunglas
dunglas deleted the fix/caddy-worker-max-failures-default branch October 10, 2026 15:12
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