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

thread 'main' panicked at 'legacy strings are not yet supported' #64

Closed
iljau opened this issue Nov 20, 2018 · 5 comments
Closed

thread 'main' panicked at 'legacy strings are not yet supported' #64

iljau opened this issue Nov 20, 2018 · 5 comments

Comments

@iljau
Copy link

iljau commented Nov 20, 2018

Got following exception, when trying to profile some Python code (lots of code and lots of library dependencies).

I'd like to provide some minimal example, which causes this exception, but I'm not sure where to start.

What are "legacy strings" in context of Python 3.6?

thread 'main' panicked at 'legacy strings are not yet supported', src/python_interpreters.rs:157:1
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:511
   5: std::panicking::begin_panic
   6: py_spy::stack_trace::copy_string
   7: py_spy::stack_trace::get_stack_traces
   8: py_spy::python_spy::PythonSpy::get_stack_traces
   9: py_spy::sample_console
  10: py_spy::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  13: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  14: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  15: main

System:

Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
$ py-spy --version
py-spy 0.1.8
@benfred
Copy link
Owner

benfred commented Nov 20, 2018

That error means that either the filename or function name in the stack trace is being represented by a non-compact python string (which became the default in python 3.3 and are described here: https://www.python.org/dev/peps/pep-0393/#deprecations-removals-and-incompatibilities).

I hadn't seen this happen ever when I was testing, so I didn't add support for this case =(. I'll add support soon - also minimally we should be just discarding the stack trace with an error instead of panicking here (likewise for ucs2 strings, which we also don't handle right now and could be used in python 2.7)

@vikahl
Copy link

vikahl commented Nov 22, 2018

While it seems that you already know what is causing it I just chime in and say that I also got the same error today:

thread 'main' panicked at 'legacy strings are not yet supported', src/python_interpreters.rs:157:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

System

$ python3 -V
  Python 3.6.7
$ py-spy --version
  py-spy 0.1.6
$ cat /etc/debian_version 
  buster/sid

@benfred
Copy link
Owner

benfred commented Dec 6, 2018

I still haven't managed to reproduce, but I believe this change will fix: #67

@benfred
Copy link
Owner

benfred commented Dec 6, 2018

fixed is in v0.1.9

@benfred benfred closed this as completed Dec 6, 2018
@iljau
Copy link
Author

iljau commented Dec 10, 2018

Just to confirm: issue was indeed solved after upgrading to py-spy 0.1.10.

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

3 participants