You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix data race in GC frame recording between signal handler and postponed job
stackprof_record_gc_samples() wrote fake GC frames (garbage collection,
marking, sweeping) directly into the shared _stackprof.frames_buffer, then
called stackprof_record_sample_for_stack() which reads from that buffer.
A signal arriving during this processing calls stackprof_buffer_sample()
from the signal handler, invoking rb_profile_frames() which overwrites
frames_buffer with real stack frames.
This caused the raw sample data to reference fake GC frame IDs that never
got added to the frames hash, producing profiles where frame lookups fail
for GC-related entries.
Fix: stackprof_record_sample_for_stack() now takes explicit frames_buffer
and lines_buffer parameters. stackprof_record_gc_samples() passes
stack-local arrays for GC frames, making them immune to signal handler
interference. stackprof_record_buffer() passes the shared global buffer
explicitly (safe because buffer_count guards against re-entry).
0 commit comments