Repository navigation
fix(obs): prune automatic heap dumps before counting the dump - #1363
Merged
Merged
Conversation
The auto-dump thread recorded aisix_heap_profile_dumps_total{trigger=auto,result=ok}
before applying the keep retention, so anyone who saw the counter move could
still list keep+1 files in the dump directory. Prune first, then count.
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 6 minutes for your next included review. View limit details
Comment |
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.
The automatic heap-dump thread incremented
aisix_heap_profile_dumps_total{trigger="auto",result="ok"}before it pruned the dump directory down tokeep. Anyone who watches the counter and then lists the directory can land between the two and seekeep + 1files. That is exactly whatmemory-observability-e2edoes, and it went red on main intermittently (keep: 2 leaves the two newest of three: expected [ …(3) ] to have a length of 2 but got 3).The fix moves
pruneahead of the success counter (and the log line), so the metric only counts a dump once retention has been applied. No test change: the existing e2e case is the regression test. With a 1.5s sleep inserted between the counter and the prune on the old ordering it fails with the same assertion every time; with the new ordering it passes, including with the same sleep placed between the prune and the counter.The manual
/debug/pprof/heapdump is the only other dump site. It streams the profile in the response, writes no file and prunes nothing, so it has no equivalent window.No behavior change beyond ordering: the same files are kept and the same counter values are reached.
🤖 Generated with Claude Code