Two python runtimes
I am running py-spy 0.1.10 on python 3.6.6 in a Docker container on RHEL 7. For most regular python programs things work fine, however one of the scripts loads an external C library that has an embedded python 2.7.10 runtime. When I try to attach py-spy to that process, I face Error: Failed to find a python interpreter in the .data section
The part of the logs that's presumably relevant for this:
INFO 2018-12-11T16:52:17Z: py_spy::process::os_impl: Target process is running in same namespace - not changing
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Found libpython binary @ /cpluspluslib/lib/thirdparty/libpython2.7.so.1.0
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Getting version from python binary BSS
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Failed to get version from BSS section: failed to find version string
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Getting version from libpython BSS
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Failed to get version from libpython BSS section: failed to find version string
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Trying to get version from path: /opt/rh/rh-python36/root/usr/bin/python3.6
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: python version 3.6.0 detected
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: got symbol interp_head (0x00007ff646e6f4b0) from libpython binary
WARN 2018-12-11T16:52:17Z: py_spy::python_spy: Interpreter address from interp_head symbol is invalid 0000000000000000
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Failed to get interp_head from symbols, scanning BSS section from main binary
INFO 2018-12-11T16:52:17Z: py_spy::python_spy: Failed to get interpreter from binary BSS, scanning libpython BSS
Error: Failed to find a python interpreter in the .data section
Yeah - it looks like it's picking up the libpython from the embedded interpreter, but the python version from the main executable =(.
When you're looking at the logs - Is there a python 3.6 libpython.so listed there as well ?
I'm not really planning on supporting sampling from both python runtimes in this case (like getting samples from both the python 2 and python 3 interpreters), but I'd like to fix so that we can sample from the main interpreter at least.