Skip to content

panic on underflowing subtraction during recording #26

@pobrn

Description

@pobrn
  • Version: 3b5f5e1 (built simply with cargo build)
  • Platform: Linux 6.1.11

Command that triggers the issue:

samply record gdb --version

gdb is from the Arch Linux repositories (version: 12.1-2).


thread '<unnamed>' panicked at 'attempt to subtract with overflow', samply/src/linux_shared/context_switch.rs:... (multiple places)

One particular panic:

Thread 2 "samply" hit Breakpoint 3, samply::linux_shared::context_switch::ContextSwitchHandler::handle_sample (self=0x7ffff7c8c2f8, timestamp=62712187706648, thread=0x7ffff0d96338)
    at samply/src/linux_shared/context_switch.rs:141
141	        let off_cpu_sample = match thread.state {
$605 = 62712187706648
$606 = samply::linux_shared::context_switch::ThreadContextSwitchData {
  state: samply::linux_shared::context_switch::ThreadState::On{last_observed_on_timestamp: 62712191834216},
  on_cpu_duration_since_last_sample: 0,
  off_cpu_duration_since_last_off_cpu_sample: 191576
}
thread '<unnamed>' panicked at 'attempt to subtract with overflow', samply/src/linux_shared/context_switch.rs:147:35

Instrumenting all ContextSwitchHandler::handle_{sample,context_in,context_out} calls gives the following:
call-log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions