test: add integration test reproducing dynamic CPU profiling bug (#259)#278
Draft
korniltsev-grafanista-yolo-vibecoder239 wants to merge 3 commits intografana:mainfrom
Conversation
…fana#259) SetCPUTrackingEnabled only controls the StackSamplerLoopManager (wall-time and manual CPU), but on Linux the actual CPU profiler is a separate TimerCreateCpuProfiler that is never started/stopped by the toggle API. The test starts the app with CPU profiling configured but dynamically disabled at startup. Phase 1 verifies that no CPU profiles are generated while disabled (this fails because timer_create keeps running). Phase 2 re-enables CPU and verifies profiles appear. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rafana#259) SetCPUTrackingEnabled only controlled the StackSamplerLoopManager (wall-time and manual CPU), but on Linux the actual CPU profiler is TimerCreateCpuProfiler which was never started/stopped by the toggle. Wire SetStackSamplerEnabled to also start/stop _pCpuProfiler, and clear ProfilerSignalManager handler state in IgnoreSignal() so the SIGPROF handler can be properly re-registered after a stop/start cycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rofiler (grafana#259)" This reverts commit 47e51fa.
1 task
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.
Summary
Reproducer for #259 (dynamic profiling not working after the crash fix in #274).
SetCPUTrackingEnabledonly controls theStackSamplerLoopManager(wall-time + manual CPU loop), but on Linux the actual CPU profiler isTimerCreateCpuProfiler— a completely independent service that is never started/stopped by the toggle API. CallingSetCPUTrackingEnabled(false)leaves the timer_create profiler running.Changes
TestDynamicCPUProfilingstarts the app with CPU profiling configured but dynamically disabled at startup. Phase 1 verifies no CPU profiles are generated while disabled (fails because timer_create keeps running). Phase 2 re-enables CPU and verifies profiles appear./profiling/cpu/enableand/profiling/cpu/disableendpoints +DYNAMIC_CPU_DISABLED_AT_STARTenv varTest plan
make -C itest itest/dynamic-cpu/glibc/8.0— expected to fail onmain(reproduces the bug)🤖 Generated with Claude Code