In order to debug a sporadic issue we're having with some of our Python code, I've been trying to get it to run in python3-debug
so that I can connect to it using gdb
when it hangs and see what's going on.
The problem is that our code relies heavily on Paramiko, and as soon as I try using it in python3-debug
weird things start happening.
It's wort mentioning, I'm using Python3.6.8 under CentOS 7.
If I just try to import paramiko
this happens:
$ python3-debug -c "import paramiko"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.local/lib/python3.6/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/home/user/.local/lib/python3.6/site-packages/paramiko/transport.py", line 89, in <module>
from paramiko.dsskey import DSSKey
File "/home/user/.local/lib/python3.6/site-packages/paramiko/dsskey.py", line 37, in <module>
from paramiko.pkey import PKey
File "/home/user/.local/lib/python3.6/site-packages/paramiko/pkey.py", line 31, in <module>
import bcrypt
File "/home/user/.local/lib/python3.6/site-packages/bcrypt/__init__.py", line 25, in <module>
from . import _bcrypt
ModuleNotFoundError: No module named '_cffi_backend'
I read up about it a bit, moved some files around (namely renamed /usr/local/lib64/python3.6/site-packages/_cffi_backend.cpython-36m-x86_64-linux-gnu.so
to /usr/local/lib64/python3.6/site-packages/_cffi_backend.so
) and then I got this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.local/lib/python3.6/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/home/user/.local/lib/python3.6/site-packages/paramiko/transport.py", line 89, in <module>
from paramiko.dsskey import DSSKey
File "/home/user/.local/lib/python3.6/site-packages/paramiko/dsskey.py", line 37, in <module>
from paramiko.pkey import PKey
File "/home/user/.local/lib/python3.6/site-packages/paramiko/pkey.py", line 31, in <module>
import bcrypt
File "/home/user/.local/lib/python3.6/site-packages/bcrypt/__init__.py", line 25, in <module>
from . import _bcrypt
ImportError: /usr/local/lib64/python3.6/site-packages/_cffi_backend.so: undefined symbol: PyModule_Create2
At this point I figured something must be broken in the dependency tree and decided to go with a virtenv:
python3-debug -m venv test-debug
cd test-debug/
. ./bin/activate
which python3-debug
# /tmp/test-debug/bin/python3-debug
python3-debug -m pip install paramiko
and then:
python3-debug -c "import paramiko"
* ob
object : <refcnt 0 at 0x2b727c0c36c8>
type : bytes
refcount: 0
address : 0x2b727c0c36c8
* op->_ob_prev->_ob_next
object : <refcnt 0 at 0x2b727c0c36c7>Segmentation fault
And that's where I'm completely lost.
Google was unhelpful, unfortunately.
Anyone have any idea what's going on and how I can get this to work?
Thanks!