fix(prometheus): bump nginx-lua-prometheus-api7 to 0.20260716 to fix 100% CPU loop on full shared dict#13708
Merged
nic-6443 merged 1 commit intoJul 20, 2026
Conversation
The bumped release fixes an unbounded retry loop in KeyIndex:add(). When the shared dict is full and __ngx_prom__key_count is LRU-evicted, sync() reads it as 0 and add() retries the same already-occupied slot forever, pegging the worker at 100% CPU independent of traffic. The new version advances the counter past the occupied slot so the next sync() adopts its occupant and progress resumes.
AlinsRan
approved these changes
Jul 20, 2026
shreemaan-abhishek
approved these changes
Jul 20, 2026
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.
Description
Bumps
nginx-lua-prometheus-api7to0.20260716, which fixes the infinite busy loop behind #12275 — workers pegged at 100% CPU on a fullprometheus-metricsshared dict, unresponsive even after traffic is removed.The root cause is in the library's
KeyIndex:add(): once the shared dict is full,__ngx_prom__key_countcan be LRU-evicted (it is an ordinary node, only refreshed when a new series is registered, so it goes cold under steady traffic).sync()then reads it asnil → 0, and every new series doesdict:add()against an already-occupied slot →"exists"→ retry the same slot → forever, without ever yielding. Full analysis, profiles and a standalone reproduction are in #12275 (comment).The fix (api7/nginx-lua-prometheus#16, released as
0.20260716) advances the counter past the occupied slot on a repeated collision, so the nextsync()adopts that slot's occupant and progress resumes; a hard cap makes it degrade to the existing dict-full error instead of spinning. The regression test lives with the fix in the library repo.I ran
t/plugin/prometheus*.tlocally against the bumped dependency and the prometheus suites pass. The only failures are the pre-existingworker-events ... failed to receive the header bytes: closedshutdown-race flake, which reproduces identically on the current0.20260623pin and is unrelated to this change.Which issue(s) this PR fixes:
Fixes #12275
Checklist