Skip to content

Commit 4a90a15

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 bc44085 commit 4a90a15

File tree

3 files changed

+2
-1
lines changed

3 files changed

+2
-1
lines changed

support/ebpf/ruby_tracer.ebpf.c

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

470471
if (in_jit) {
471472
if (rubyinfo->frame_pointers_enabled) {

support/ebpf/tracer.ebpf.amd64

320 Bytes
Binary file not shown.

support/ebpf/tracer.ebpf.arm64

144 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)