Giter VIP home page Giter VIP logo

Comments (2)

sliedes avatar sliedes commented on June 8, 2024

Here's a backtrace I got. So far didn't manage yet to get a RUST_BACKTRACE=full. It sometimes works, sometimes hits this, and sometimes segfaults with the same target.

$ RUST_BACKTRACE=1 .../py-spy record -r 1000 -o profile.speedscope -f speedscope --idle --nonblocking -- python -m ...
py-spy> Sampling process 1000 times a second. Press Control-C to exit.

thread '<unnamed>' panicked at src/python_interpreters.rs:396:16:
index out of bounds: the len is 2 but the index is 2
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:208:5
   3: py_spy::python_interpreters::read_varint
             at /home/sami/proj/chat/py-spy/src/python_interpreters.rs:396:16
   4: py_spy::python_interpreters::read_signed_varint
             at /home/sami/proj/chat/py-spy/src/python_interpreters.rs:405:24
   5: <py_spy::python_bindings::v3_11_0::PyCodeObject as py_spy::python_interpreters::CodeObject>::get_line_number
             at /home/sami/proj/chat/py-spy/src/python_interpreters.rs:461:33
   6: py_spy::stack_trace::get_line_number
             at /home/sami/proj/chat/py-spy/src/stack_trace.rs:224:8
   7: py_spy::stack_trace::get_stack_trace
             at /home/sami/proj/chat/py-spy/src/stack_trace.rs:141:46
   8: py_spy::python_spy::PythonSpy::_get_stack_traces
             at /home/sami/proj/chat/py-spy/src/python_spy.rs:241:29
   9: py_spy::python_spy::PythonSpy::get_stack_traces
             at /home/sami/proj/chat/py-spy/src/python_spy.rs:180:18
  10: py_spy::sampler::Sampler::new_sampler::{{closure}}
             at /home/sami/proj/chat/py-spy/src/sampler.rs:66:36
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at src/sampler.rs:264:22:
called `Result::unwrap()` on an `Err` value: Any { .. }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: <py_spy::sampler::Sampler as core::ops::drop::Drop>::drop
             at /home/sami/proj/chat/py-spy/src/sampler.rs:264:13
   5: core::ptr::drop_in_place<py_spy::sampler::Sampler>
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ptr/mod.rs:507:1
   6: py_spy::record_samples
             at /home/sami/proj/chat/py-spy/src/main.rs:232:5
   7: py_spy::run_spy_command
             at /home/sami/proj/chat/py-spy/src/main.rs:378:13
   8: py_spy::pyspy_main
             at /home/sami/proj/chat/py-spy/src/main.rs:452:22
   9: py_spy::main
             at /home/sami/proj/chat/py-spy/src/main.rs:488:23
  10: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I think it may have something to do with the fairly large number of threads my app spawns (it has a thread pool of ~45 workers). It also uses asyncio.

The precise version I'm running is HEAD as of today (7cbbc01) with this added patch IIRC to help make more sense of some threaded code:

diff --git a/src/python_spy.rs b/src/python_spy.rs
index f5e36d6..e8c02da 100644
--- a/src/python_spy.rs
+++ b/src/python_spy.rs
@@ -347,6 +347,8 @@ impl PythonSpy {
         } else {
             let frame = &frames[0];
             (frame.name == "wait" && frame.filename.ends_with("threading.py"))
+                || (frame.name == "_worker" && frame.filename.ends_with("concurrent/futures/thread.py"))
+                || (frame.name == "_recv" && frame.filename.ends_with("multiprocessing/connection.py"))
                 || (frame.name == "select" && frame.filename.ends_with("selectors.py"))
                 || (frame.name == "poll"
                     && (frame.filename.ends_with("asyncore.py")

from py-spy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.