fix: stop server-owned cache workers during shutdown - #248
Merged
stefan-ernst merged 1 commit intoSep 9, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server shutdown leaves BigCache cleanup workers running. With the session validation cache disabled, two successive start/stop cycles left four additional workers each. Enabling session caching adds another cache that also lacked shutdown ownership.
The HTTP server now retains and closes its permission, session, API-token, SCIM-token and item-hierarchy caches. Their
Closemethods tolerate repeated calls and disabled caches; they do not close the shared database. Partial startup failure also closes these caches and signals already-started background loops to stop. Unrelated cache instances are left alone.Regression tests are on the separate core-tests branch. They exercise real server lifecycles with session caching enabled and disabled, repeated shutdown, an unrelated cache, and a failed startup after cache allocation. Additional tests cover concurrent repeated
Closecalls and absent caches. The original four-worker leak was reproduced before the fix.SQLite and PostgreSQL shutdown regressions pass with the race detector, including enabled/disabled session caches. The startup-failure case is SQLite-only. The full
internal/auth,internal/servicesandinternal/serverpackage runs passed, as did the quick suite (five Go packages, 14 frontend files/123 tests).go vetand the configured linter passed for the changed packages.This does not establish the cause of an earlier PostgreSQL suite timeout. Closed caches remain referenced by the diagnostics registry until replaced; this fix stops their workers, not all retained cache memory. No authentication rules, TTLs or cache budgets change.