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

pyspy panic on m1 #120

Open
korniltsev opened this issue Jul 7, 2023 · 1 comment
Open

pyspy panic on m1 #120

korniltsev opened this issue Jul 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@korniltsev
Copy link
Collaborator

  pyroscope_cli git:(chore/use_rbspy_fork_crate) sudo ./target/debug/pyroscope-cli connect --pid 78252  --spy-name pyspy  --server-address="http://localhost:4100"
Jul 07 12:02:21.449 INFO we recommend specifying application name via -application-name flag or env variable PYROSCOPE_APPLICATION_NAME, who: pyroscope-cli
Jul 07 12:02:21.449 INFO Profiling with pyspy profiler with application name: pyspy.vulgar.swing, who: pyroscope-cli
Jul 07 12:02:21.450 INFO Initializing Timer, who: pyroscope-cli
Jul 07 12:02:21.450 INFO Creating SessionManager, who: pyroscope-cli
Press Ctrl-C to exit.
Jul 07 12:02:21.461 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:21.464 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:21.507 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.507 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:21.513 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:21.513 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:21.513 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.513 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:21.513 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:21.513 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:21.589 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:21.627 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:21.630 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:21.673 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.673 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:21.673 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:21.673 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:21.673 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.673 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:21.673 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:21.673 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:21.781 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:21.819 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:21.822 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:21.864 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.864 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:21.864 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:21.865 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:21.865 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:21.865 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:21.865 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:21.865 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:21.973 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:22.011 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:22.014 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:22.056 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.056 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:22.057 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:22.057 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:22.057 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.057 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:22.057 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:22.057 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:22.166 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:22.204 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:22.206 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:22.250 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.250 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:22.250 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:22.250 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:22.250 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.250 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:22.250 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:22.250 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:22.359 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:22.397 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:22.399 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:22.443 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.443 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:22.443 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:22.443 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:22.443 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.443 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:22.443 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:22.443 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:22.552 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:22.590 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:22.592 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:22.635 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.635 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:22.635 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:22.635 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:22.635 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.635 WARN Interpreter address from _PyRuntime symbol is invalid 0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:22.635 INFO Failed to get interp_head from symbols, scanning BSS section from main binary, who: pyroscope-cli
Jul 07 12:02:22.635 INFO Failed to get interpreter from binary BSS, scanning libpython BSS, who: pyroscope-cli
Jul 07 12:02:22.744 INFO Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section, who: pyroscope-cli
Jul 07 12:02:22.782 INFO Got virtual memory maps from pid 78252:, who: pyroscope-cli
Jul 07 12:02:22.785 INFO Found libpython binary @ /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/Python, who: pyroscope-cli
Jul 07 12:02:22.827 INFO got symbol Py_GetVersion.version (0x0000000100e16e90) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.827 INFO Getting version from symbol address, who: pyroscope-cli
Jul 07 12:02:22.828 INFO Found matching version string '3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202', who: pyroscope-cli
Jul 07 12:02:22.828 INFO python version 3.11.3 detected, who: pyroscope-cli
Jul 07 12:02:22.828 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.828 INFO Found interpreter at 0x0000000100dbbd48, who: pyroscope-cli
Jul 07 12:02:22.828 INFO got symbol _PyRuntime (0x0000000100dad6d8) from libpython binary, who: pyroscope-cli
Jul 07 12:02:22.828 INFO Found _PyRuntime @ 0x0000000100dad6d8, getting gilstate.tstate_current from offset 0x270, who: pyroscope-cli
Backtrace (most recent call last):
  File "<unknown>:0", in __pthread_joiner_wake
  File "rust:library/std/src/sys/unix/thread.rs:108", in std::sys::unix::thread::Thread::new::thread_start
  File "rust:library/alloc/src/boxed.rs:1951", in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
  File "rust:library/alloc/src/boxed.rs:1951", in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
  File "rust:library/core/src/ops/function.rs:248", in core::ops::function::FnOnce::call_once{{vtable.shim}}
  File "rust:library/std/src/thread/mod.rs:504", in std::thread::Builder::spawn_unchecked_::{{closure}}
  File "rust:library/std/src/panic.rs:137", in std::panic::catch_unwind
  File "rust:library/std/src/panicking.rs:456", in std::panicking::try
  File "<unknown>:0", in ___rust_try
  File "rust:library/std/src/panicking.rs:492", in std::panicking::try::do_call
  File "rust:library/core/src/panic/unwind_safe.rs:271", in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  File "rust:library/std/src/thread/mod.rs:505", in std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
  File "rust:library/std/src/sys_common/backtrace.rs:122", in std::sys_common::backtrace::__rust_begin_short_backtrace
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/sampler.rs:61", in py_spy::sampler::Sampler::new_sampler::{{closure}}
    let traces = match spy.get_stack_traces() {
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/python_spy.rs:193", in py_spy::python_spy::PythonSpy::get_stack_traces
    Version{major: 3, minor: 11, ..} => self._get_stack_traces::<v3_11_0::_is>(),
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/python_spy.rs:228", in py_spy::python_spy::PythonSpy::_get_stack_traces
    let mut trace = get_stack_trace(&thread, &self.process, self.config.dump_locals > 0, self.config.lineno)?;
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/stack_trace.rs:107", in py_spy::stack_trace::get_stack_trace
    LineNo::LastInstruction => match get_line_number(&code, frame.lasti(), process) {
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/stack_trace.rs:163", in py_spy::stack_trace::get_line_number
    Ok(code.get_line_number(lasti, &table))
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/python_interpreters.rs:355", in <py_spy::python_bindings::v3_11_0::PyCodeObject as py_spy::python_interpreters::CodeObject>::get_line_number
    read_varint(&mut index, table); // start column
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/python_interpreters.rs:305", in py_spy::python_interpreters::read_varint
    ret += ((byte & 63) as usize) << shift;
  File "rust:library/core/src/panicking.rs:48", in core::panicking::panic

The application panicked (crashed).
  attempt to shift left with overflow
in /Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/python_interpreters.rs:305
thread: <unnamed>
Backtrace (most recent call last):
  File "<unknown>:0", in __pthread_joiner_wake
  File "rust:library/std/src/sys/unix/thread.rs:108", in std::sys::unix::thread::Thread::new::thread_start
  File "rust:library/alloc/src/boxed.rs:1951", in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
  File "rust:library/alloc/src/boxed.rs:1951", in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
  File "rust:library/core/src/ops/function.rs:248", in core::ops::function::FnOnce::call_once{{vtable.shim}}
  File "rust:library/std/src/thread/mod.rs:504", in std::thread::Builder::spawn_unchecked_::{{closure}}
  File "rust:library/std/src/panic.rs:137", in std::panic::catch_unwind
  File "rust:library/std/src/panicking.rs:456", in std::panicking::try
  File "<unknown>:0", in ___rust_try
  File "rust:library/std/src/panicking.rs:492", in std::panicking::try::do_call
  File "rust:library/core/src/panic/unwind_safe.rs:271", in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  File "rust:library/std/src/thread/mod.rs:505", in std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
  File "rust:library/std/src/sys_common/backtrace.rs:122", in std::sys_common::backtrace::__rust_begin_short_backtrace
  File "/Users/korniltsev/pyroscope/pyroscope-rs/pyroscope_backends/pyroscope_pyspy/src/lib.rs:297", in <pyroscope_pyspy::Pyspy as pyroscope::backend::backend::Backend>::initialize::{{closure}}
    for sample in sampler_output {
  File "rust:library/core/src/ptr/mod.rs:487", in core::ptr::drop_in_place<core::iter::adapters::take_while::TakeWhile<py_spy::sampler::Sampler,<pyroscope_pyspy::Pyspy as pyroscope::backend::backend::Backend>::initialize::{{closure}}::{{closure}}>>
  File "rust:library/core/src/ptr/mod.rs:487", in core::ptr::drop_in_place<py_spy::sampler::Sampler>
  File "/Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/sampler.rs:218", in <py_spy::sampler::Sampler as core::ops::drop::Drop>::drop
    t.join().unwrap();
  File "rust:library/core/src/result.rs:1098", in core::result::Result<T,E>::unwrap

The application panicked (crashed).
  called `Result::unwrap()` on an `Err` value: Any { .. }
in /Users/korniltsev/.cargo/registry/src/github.com-1ecc6299db9ec823/py-spy-0.3.14/src/sampler.rs:218
thread: <unnamed>

doc.py:

import traceback


class FileOrData(object):
    """Utility class to read content of obj[%data_key_name] or file's
     content of obj[%file_key_name] and represent it as file or data.
     Note that the data is preferred. The obj[%file_key_name] will be used iff
     obj['%data_key_name'] is not set or empty. Assumption is file content is
     raw data and data field is base64 string. The assumption can be changed
     with base64_file_content flag. If set to False, the content of the file
     will assumed to be base64 and read as is. The default True value will
     result in base64 encode of the file content after read."""

    """
    huihui
    """
    def __init__(self):
        pass


if __name__ == "__main__":
    while True:
        try:
            import doc
            import importlib
            importlib.reload(doc)
            del doc
        except:
            pass%

qweqwe.py:

if __name__ == "__main__":
    while True:
        try:
            import doc
            import importlib
            importlib.reload(doc)
            del doc
        except:
            pass
            ```
@korniltsev korniltsev added the bug Something isn't working label Jul 7, 2023
@venu-shapley
Copy link

Getting the following error when using pyroscope profiling on a python app. This was right after the configure step.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants