Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Attempt to substract with overflow' in linux/symbolication #183

Closed
aldanor opened this issue Oct 16, 2019 · 3 comments
Closed

'Attempt to substract with overflow' in linux/symbolication #183

aldanor opened this issue Oct 16, 2019 · 3 comments

Comments

@aldanor
Copy link

aldanor commented Oct 16, 2019

Tried running crate tests on CentOS 7, with libunwind built manually (due to issues linking to the system-wide one, described in another issue), both vs the system Python and with Python 3.6 from conda installation.

All unit tests pass, but all integration tests fail with a weird overflow error:

'test_busy_loop' panicked at 'attempt to subtract with overflow', 
remoteprocess/src/linux/symbolication.rs:90:40

Looks like this subtraction is failing:

let obj_base = match program_header {
Some(hdr) => { m.start() as u64 - hdr.p_vaddr },

Full backtrace
---- test_busy_loop stdout ----
thread 'test_busy_loop' panicked at 'attempt to subtract with overflow', remoteprocess/src/linux/symbolication.rs:90:40
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::panicking::panic
             at src/libcore/panicking.rs:49
  11: remoteprocess::linux::symbolication::Symbolicator::reload
             at remoteprocess/src/linux/symbolication.rs:90
  12: remoteprocess::linux::symbolication::Symbolicator::new
             at remoteprocess/src/linux/symbolication.rs:28
  13: remoteprocess::linux::Process::symbolicator
             at remoteprocess/src/linux/mod.rs:113
  14: py_spy::native_stack_trace::NativeStack::new
             at src/native_stack_trace.rs:32
  15: py_spy::python_spy::PythonSpy::new
             at src/python_spy.rs:111
  16: py_spy::python_spy::PythonSpy::retry_new
             at src/python_spy.rs:131
  17: integration_test::TestRunner::new
             at tests/integration_test.rs:14
  18: integration_test::test_busy_loop
             at tests/integration_test.rs:37
  19: integration_test::test_busy_loop::{{closure}}
             at tests/integration_test.rs:29
  20: core::ops::function::FnOnce::call_once
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/ops/function.rs:231
  21: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/boxed.rs:746
  22: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  23: std::panicking::try
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libstd/panicking.rs:275
  24: std::panic::catch_unwind
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libstd/panic.rs:394
  25: test::run_test::run_test_inner::{{closure}}
             at src/libtest/lib.rs:1466
@benfred
Copy link
Owner

benfred commented Oct 21, 2019

I just tried this with Centos7 (using the py-spy v0.2.2 installed via pip) and it worked fine for me - with both the v2.7.5 and v3.6.8 versions installed through yum =(.

Does this just happen in the integration tests?

benfred added a commit that referenced this issue Oct 21, 2019
With linux, we were loading up symbolication data even when not doing native
extension profiling - since we unwind the stack to figure out the pthreadid
/native threadid mapping. This caused an issue where loading symbols paniced
(#183). Change to not load symbols unless needed. Also try to handle the
underlying error.
@benfred
Copy link
Owner

benfred commented Oct 21, 2019

Still haven't managed to reproduce - but #187 there should fix the problem hopefully

@benfred
Copy link
Owner

benfred commented Oct 27, 2019

Fix is in v0.3.0 - let me know if this doesn't work out for you

@benfred benfred closed this as completed Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants