-
Notifications
You must be signed in to change notification settings - Fork 11
Fix calltrace_storage counters accumulating unboundedly across rotations #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c7141d4
e6ecaff
26e08e0
e9e6271
a846b1e
5d2efda
bf80991
ffc7322
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -106,11 +106,14 @@ public void test(@CStack String cstack) throws ExecutionException, InterruptedEx | |||||||||
| assertInRange(method2Weight / (double) totalWeight, 0.1, 0.6); | ||||||||||
| assertInRange(method3Weight / (double) totalWeight, 0.05, 0.6); | ||||||||||
| } | ||||||||||
| // The recording captures counter values before the final cleanup (before processTraces | ||||||||||
| // runs and frees all traces). Verify the recording contains meaningful data. | ||||||||||
| assertInRange(getRecordedCounterValue("calltrace_storage_traces"), 1, 100); | ||||||||||
| assertInRange(getRecordedCounterValue("calltrace_storage_bytes"), 1024, 8 * 1024 * 1024); | ||||||||||
| // live counters are 0 after stop (all traces freed - correct, non-leaking behaviour) | ||||||||||
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | ||||||||||
|
||||||||||
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | |
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | |
| assertEquals(0, debugCounters.get("calltrace_storage_traces")); | |
| assertEquals(0, debugCounters.get("calltrace_storage_bytes")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed — same fix: added assertions for calltrace_storage_traces and calltrace_storage_bytes being 0 after stopProfiler(), consistent with the nearby comment and linear_allocator checks.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -196,11 +196,14 @@ void test(AbstractProfilerTest test, boolean assertContext, String cstack) throw | |||||||||
| assertWeight("method2Impl", totalWeight, method2Weight, 0.33, allowedError); | ||||||||||
| // method3 has as much self time as method1, and should account for half the executor's thread's time | ||||||||||
| assertWeight("method3Impl", totalWeight, method3Weight, 0.33, allowedError); | ||||||||||
| // The recording captures counter values before the final cleanup (before processTraces | ||||||||||
| // runs and frees all traces). Verify the recording contains meaningful data. | ||||||||||
| assertInRange(test.getRecordedCounterValue("calltrace_storage_traces"), 1, 100); | ||||||||||
| assertInRange(test.getRecordedCounterValue("calltrace_storage_bytes"), 1024, 8 * 1024 * 1024); | ||||||||||
| // live counters are 0 after stop (all traces freed - correct, non-leaking behaviour) | ||||||||||
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | ||||||||||
|
||||||||||
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | |
| Map<String, Long> debugCounters = profiler.getDebugCounters(); | |
| assertEquals(0, debugCounters.get("calltrace_storage_traces")); | |
| assertEquals(0, debugCounters.get("calltrace_storage_bytes")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed — added assertions for calltrace_storage_traces and calltrace_storage_bytes being 0 after getDebugCounters() to verify the non-leaking post-cleanup state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decrementCounters()builds anunordered_setof seenCallTrace*but never reserves capacity. On large tables this will cause repeated rehashing while iterating every slot. SinceLongHashTable::size()is available, consider summing sizes across the chain and callingseen.reserve(estimatedDistinct)before insertion to keep the clear/rotation overhead bounded.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed — pre-computed the sum of sizes across the chain and called
seen.reserve(estimated_entries)to avoid repeated rehashing on large tables.