Repository navigation
Conversation
prometheus_client requires the multiprocess directory to be wiped between runs. Without it, a restart that keeps the directory (a container restart within the same pod, where /dev/shm survives) lets new processes reuse the old per-PID files, and labelsets the old processes wrote keep being exported. https://prometheus.github.io/client_python/multiprocess/ Co-Authored-By: Claude Opus 5.5 <[email protected]>
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@BeryJu thanks for merging #27771! This one is its companion and I think it's still needed: The NaN for deleted pairs only works while the process that wrote the old labelset is alive. authentik never wipes Reproduced with a dev image of
With this PR the |
Details
What does this PR change?
bootstrap()deletes the.dbfiles in the Prometheus multiprocess directory before the server, worker or all-in-one start (and before migrations). Only.dbfiles are removed, so aPROMETHEUS_MULTIPROC_DIRpointing at a shared path loses nothing else.Why is this change needed?
prometheus_client requires the multiprocess directory to be wiped between runs: https://prometheus.github.io/client_python/multiprocess/
authentik creates the directory but never wipes it. When it survives a restart (a container restart inside the same pod keeps
/dev/shm), the new processes reuse the old per-worker files, and every labelset the previous processes wrote keeps being exported, including values no live process will ever overwrite.How was this tested?
src/boot.rs:.dbfiles are removed, other files and directories are kept.main, deleted a certificate-key pair (with the metric from crypto: export certificate expiry as a Prometheus metric #27771) without scraping, restarted the server container: before, the deleted pair kept its old expiry; after, it is gone.oidc_rp-initiatedfailed withupload_image failed - HTTP 400 File size exceeds the 500KB limit, which also fails onmain.Side effect: Python counters and histograms start from zero after every restart, which Prometheus treats as a normal counter reset.
Linked issues
refs #27771
AI disclosure: written with Claude Code (Claude Opus 5.5), which drafted the code, test and this description; I reviewed, ran and tested the change myself.
Checklist
make all)make docs)