Cache configuration lost on reload
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Reproduziere das Problem mit dem gezeigten Caddyfile, indem du Caddy startest, den Nuts-Cache füllst und anschließend caddy reload --config /etc/caddy/Caddyfile ausführst. Verfolge das Neuladen des Cache-Handlers und die Initialisierung des Nuts-Speichers und konzentriere dich darauf, warum das Neuladen den Standardspeicher auswählt. Erledigt ist die Aufgabe, wenn der konfigurierte Speicher /tmp/nuts-configuration nach dem Neuladen aktiv bleibt, keine Warnung zum Standardspeicher ausgegeben wird und zwischengespeicherte Anfragen weiterhin Treffer melden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hello,
whenever I reload Caddy, either automatically by using the -w flag of caddy run or by running caddy reload --config /etc/caddy/Caddyfile, the cache seems to loose its configuration.
When first starting caddy, everything looks fine:
{"level":"info","ts":1764181169.6021588,"msg":"maxprocs: Leaving GOMAXPROCS=6: CPU quota undefined"}
{"level":"info","ts":1764181169.6022556,"msg":"GOMEMLIMIT is updated","package":"github.com/KimMachineGun/automemlimit/memlimit","GOMEMLIMIT":15010014412,"previous":9223372036854775807}
{"level":"info","ts":1764181169.602276,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
{"level":"info","ts":1764181169.603072,"msg":"adapted config to JSON","adapter":"caddyfile"}
{"level":"warn","ts":1764181169.6030767,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":4}
{"level":"info","ts":1764181169.603848,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1764181169.604289,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0001b2180"}
{"level":"info","ts":1764181169.6060863,"logger":"http.handlers.cache","msg":"Set backend timeout to 10s"}
{"level":"info","ts":1764181169.6061225,"logger":"http.handlers.cache","msg":"Set cache timeout to 10ms"}
{"level":"info","ts":1764181169.606124,"logger":"http.handlers.cache","msg":"Souin configuration is now loaded."}
{"level":"warn","ts":1764181169.6062827,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":4443"}
{"level":"warn","ts":1764181169.6062887,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":4443"}
{"level":"info","ts":1764181169.60629,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1764181169.6107454,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}
{"level":"info","ts":1764181169.6107526,"msg":"serving initial configuration"}
{"level":"info","ts":1764181169.6152978,"logger":"tls","msg":"cleaning storage unit","storage":"FileStorage:/root/.local/share/caddy"}
{"level":"info","ts":1764181169.6198232,"logger":"tls","msg":"finished cleaning storage units"}
I can verify that caching works:
$ curl -i localhost:4443/nuts-configuration
HTTP/1.1 200 OK
Cache-Control:
Cache-Status: Souin; fwd=uri-miss; stored; key=GET-http-localhost:4443-/nuts-configuration
Content-Length: 10
Content-Type: text/plain; charset=utf-8
Server: Caddy
Date: Wed, 26 Nov 2025 18:25:42 GMT
Hello nuts
$ curl -i localhost:4443/nuts-configuration
HTTP/1.1 200 OK
Age: 2
Cache-Control:
Cache-Status: Souin; hit; ttl=1498; key=GET-http-localhost:4443-/nuts-configuration; detail=NUTS
Content-Length: 10
Content-Type: text/plain; charset=utf-8
Date: Wed, 26 Nov 2025 18:25:42 GMT
Server: Caddy
Hello nuts
$ curl -i localhost:4443/nuts-configuration
HTTP/1.1 200 OK
Age: 4
Cache-Control:
Cache-Status: Souin; hit; ttl=1496; key=GET-http-localhost:4443-/nuts-configuration; detail=NUTS
Content-Length: 10
Content-Type: text/plain; charset=utf-8
Date: Wed, 26 Nov 2025 18:25:42 GMT
Server: Caddy
Hello nuts
Then after editing a trivial thing, e.g. appending a number to the static response body, and running caddy reload --config /etc/caddy/Caddyfile:
{"level":"info","ts":1764181205.652986,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_ip":"127.0.0.1","remote_port":"53638","headers":{"Accept-Encoding":["gzip"],"Content-Length":["1513"],"Content-Type":["application/json"],"Origin":["http://localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
{"level":"info","ts":1764181205.6536577,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"warn","ts":1764181205.6540132,"logger":"http.handlers.cache","msg":"You're running Souin with the default storage that is not optimized and for development purpose. We recommend to use at least one of the storages from https://github.com/darkweak/storages"}
{"level":"info","ts":1764181205.654029,"logger":"http.handlers.cache","msg":"Set backend timeout to 10s"}
{"level":"info","ts":1764181205.6540427,"logger":"http.handlers.cache","msg":"Set cache timeout to 10ms"}
{"level":"info","ts":1764181205.6540506,"logger":"http.handlers.cache","msg":"Souin configuration is now loaded."}
{"level":"warn","ts":1764181205.6541312,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":4443"}
{"level":"warn","ts":1764181205.6541579,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":4443"}
{"level":"info","ts":1764181205.6541655,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1764181205.6541889,"logger":"http","msg":"servers shutting down with eternal grace period"}
{"level":"info","ts":1764181205.6543622,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}
{"level":"info","ts":1764181205.6543758,"logger":"admin.api","msg":"load complete"}
{"level":"info","ts":1764181205.654874,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
Note the You're running Souin with the default storage that is not optimized and for development purpose. We recommend to use at least one of the storages from https://github.com/darkweak/storages message.
Afterwards the cache is gone, note the uri-miss in the Cache-Status header:
$ curl -i localhost:4443/nuts-configuration
HTTP/1.1 200 OK
Cache-Control:
Cache-Status: Souin; fwd=uri-miss; stored; key=GET-http-localhost:4443-/nuts-configuration
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Server: Caddy
Date: Wed, 26 Nov 2025 18:26:10 GMT
Hello nuts2
After a complete Caddy restart, the cache will be back!
This is my Caddyfile:
:4443
respond "Hello World!"
route /nuts-configuration {
cache {
ttl 1500s
nuts {
configuration {
Dir /tmp/nuts-configuration
EntryIdxMode 1
RWMode 0
SegmentSize 1024
NodeNum 42
SyncEnable true
StartFileLoadingMode 1
}
}
}
respond "Hello nuts"
}
- Vorherrschende Sprache
- Go
- Sterne
- 394
- Forks
- 30
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus caddyserver/cache-handler
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
caddyserver/cache-handler#138 · 1 Kommentar · 3 Reaktionen ·
-
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 45/100
caddyserver/cache-handler#146 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
caddyserver/cache-handler#145 ·
-
Admin API purge/invalidation still panics with nil pointer on v0.16.0 (same root cause as #140)Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 76/100
caddyserver/cache-handler#143 · 2 Kommentare ·
-
Can not flush cacheOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
caddyserver/cache-handler#140 · 4 Kommentare · 1 Reaktion ·
Alle Issues in caddyserver/cache-handler
Ähnliche Issues
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
WriterSetTimes: the UTIME_NOW check fails when the kernel uses its coarse clockEvtl. vergeben @JakeChampion hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
JakeChampion/lang#14224 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent-butler-finding bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
jordansmall/spindrift#6391 ·
Maintainer antworten meist innerhalb von 1 Tag
-
common.Retry: data race on the shared response/err variables when the request context ends mid-attempt (v65.127.0, v65.128.0)Evtl. vergeben @kmohit00 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
oracle/oci-go-sdk#676 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
SAP/crossplane-provider-btp#1175 ·
Maintainer antworten meist innerhalb von 1 Tag