app_profiler
app_profiler copied to clipboard
Fix stale profile-running state after `/profile` start conflicts
Summary
This fixes a server-side state bug where the profile app could get stuck thinking a profile was running after a failed start/conflict, causing later /profile requests to incorrectly return conflict.
Root Cause
ProfileApplication#start_running set @profile_running = true before attempting AppProfiler.start, but did not reliably reset it when start returned false (conflict) or raised.
Changes
- Updated
start_runningto reset@profile_runningwhenAppProfiler.startdoes not start successfully. - Added a rescue path to reset
@profile_runningbefore re-raising startup exceptions. - Added regression coverage proving profiling works again after an external conflict clears.
Files Changed
/Users/afurm/Development/app_profiler/lib/app_profiler/server.rb/Users/afurm/Development/app_profiler/test/app_profiler/profile_server_test.rb
Test Plan
bundle exec ruby -Itest test/app_profiler/profile_server_test.rbbundle exec rake test
Both pass locally.
Why This Matters
Without this fix, one conflict event can poison the process-local state and block all subsequent profiling attempts until restart.