Skip to content

caddytls: publish cache options when the TLS app starts - #8406

Open
darkweak wants to merge 2 commits into
caddyserver:masterfrom
darkweak:fix-tls-cache-options-on-start
Open

darkweak wants to merge 2 commits into
caddyserver:masterfrom
darkweak:fix-tls-cache-options-on-start

Conversation

@darkweak

Copy link
Copy Markdown
Contributor

Provision replaced the shared cache's GetConfigForCert callback with the app still being provisioned. If maintenance ran in that window it read a partially
provisioned app (nil automation) and panicked. A failed load also left the callback pointing at the failed app.

Provision now only creates the cache if none exists; the callback switches to the new app in Start, once the config is becoming active. Includes a regression test.

The leaked read lock is fixed separately in caddyserver/certmagic#428.

Fixes #8231

AI disclosure: written with the help of Claude Opus 5.5 (Claude Code); reviewed and tested by me.

Provision replaced the shared certificate cache's GetConfigForCert
callback with one pointing at the app being provisioned. If cache
maintenance ran during that window it consulted a partially provisioned
app (nil automation config), panicking while holding the cache read lock.
A config that failed to load also left the cache pointing at it.

Only create the cache in Provision; switch its options to the new app in
Start, once the config is actually becoming active.

Fixes caddyserver#8231 (Caddy side; the leaked read lock needs a CertMagic fix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant