Skip to content

Commit eedbf07

Browse files
committed
Fix duplicate JIT frames on tail call re-entry
walk_ruby_stack is re-entered via tail calls to process more frames. On re-entry, in_jit was recomputed from record->state.pc which hasn't changed (non-FP path), causing the JIT frame to be pushed again on every tail call. Guard with !jit_detected so the JIT frame is only pushed once on the first entry.
1 parent 6c12fe5 commit eedbf07

3 files changed

Lines changed: 2 additions & 1 deletion

File tree

support/ebpf/ruby_tracer.ebpf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ static EBPF_INLINE ErrorCode walk_ruby_stack(
461461
// When frame pointers are not available, we push a single dummy JIT frame and
462462
// set jit_detected to suppress native unwinding.
463463
bool in_jit = rubyinfo->jit_start > 0 && record->state.pc >= rubyinfo->jit_start &&
464-
record->state.pc < rubyinfo->jit_end;
464+
record->state.pc < rubyinfo->jit_end &&
465+
!record->rubyUnwindState.jit_detected;
465466

466467
if (in_jit) {
467468
if (rubyinfo->frame_pointers_enabled) {

support/ebpf/tracer.ebpf.amd64

232 Bytes
Binary file not shown.

support/ebpf/tracer.ebpf.arm64

264 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)