Problems restarting caddy via admin api

I do have caddy and caddy-docker-proxy configured, and I use watchtower to reload my containers automatically when updated. Very handy when developing, especially because one of the last stages of my CI/CD pipeline does trigger a reload and I can test the new version of my container. While doing that, I notice that somehow caddy (and caddy-docker-proxy) does appear to accumulate old stuff, for example I see this message after several reloads in my caddy log:

quic listener tls configs are more than 2

Anyone any ideas what might be causing this? Ideas to debug this?

Occasionally I also see that during a restart the Redis module for certificate storage has problems with its open socket connection. I get errors like this:

storing last clean info: Unable to create directory for key last_clean.json: Unable to add last_clean.json to Set caddy: redis: client is closed

Could these two be related? These problems all go away if I restart caddy completely and not via the admin API.

When config is reloaded, Caddy may run two versions of the config (old and new) when connections to the old config are still persistent. By default, Caddy will not force-close those connections. Consider configuring grace_period to allow Caddy to force-close those connections after reload or shutdown.

For the Redis errors, I’m not sure. You’d have to check with the maintainer of the redis-storage plugin.

I have added a grace_period of 20s and I have not yet have any of these errors. I do though see quite often the error context canceled with server shutdown and in a second line with HTTP/3 server shutdown.

Interestingly, I am again seeing after a lot of admin restarts the following message:

no port can be announced, specify it explicitly using Server.Port or Server.Addr
setting HTTP/3 Alt-Svc header

I did a lot of changes yesterday (upgrading to go1.24) and after so many restarts I did see that message flooding my logs. This is all with the current master branch. To me, it looks like some things remain after an admin restart, accumulating in the caddy process. A restart of caddy alway fixes these kind of error messages.