Skip to content

test: add integration test reproducing dynamic CPU profiling bug (#259)#278

Draft
korniltsev-grafanista-yolo-vibecoder239 wants to merge 3 commits intografana:mainfrom
korniltsev-grafanista-yolo-vibecoder239:vk/3de0-dynamic-profilin
Draft

test: add integration test reproducing dynamic CPU profiling bug (#259)#278
korniltsev-grafanista-yolo-vibecoder239 wants to merge 3 commits intografana:mainfrom
korniltsev-grafanista-yolo-vibecoder239:vk/3de0-dynamic-profilin

Conversation

@korniltsev-grafanista-yolo-vibecoder239
Copy link
Copy Markdown
Contributor

@korniltsev-grafanista-yolo-vibecoder239 korniltsev-grafanista-yolo-vibecoder239 commented Apr 13, 2026

Summary

Reproducer for #259 (dynamic profiling not working after the crash fix in #274).

SetCPUTrackingEnabled only controls the StackSamplerLoopManager (wall-time + manual CPU loop), but on Linux the actual CPU profiler is TimerCreateCpuProfiler — a completely independent service that is never started/stopped by the toggle API. Calling SetCPUTrackingEnabled(false) leaves the timer_create profiler running.

Changes

  • Integration testTestDynamicCPUProfiling starts 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.
  • Rideshare app — added /profiling/cpu/enable and /profiling/cpu/disable endpoints + DYNAMIC_CPU_DISABLED_AT_START env var

Test plan

  • make -C itest itest/dynamic-cpu/glibc/8.0 — expected to fail on main (reproduces the bug)

🤖 Generated with Claude Code

…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>
@korniltsev-grafanista-yolo-vibecoder239 korniltsev-grafanista-yolo-vibecoder239 changed the title fix: dynamic CPU profiling toggle (SetCPUTrackingEnabled) test: add integration test reproducing dynamic CPU profiling bug (#259) Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant