Usually, if a Python-based application hangs, you either read logs or grab one of the PBD-based solutions, attaching to the application, and uses the Python console for investigation. The approach is straightforward; for example, you installed
pdb_attach.listen(50000)
and expect that “magic” will just works:
(Pdb) YOU HAVE PDB SESSION HERE
But sometimes, magic is broken, and my theory is (I didn’t search for proof) that this is due to GIL. So, sometimes, no PDB prompt after you have attached to the application with PDB. In my case, the application hang in the
This is a general PDB-based debuggers issue, which means all other tools like
Then you can connect to your Python application which is a regular Python process with GDB, and explore the call-stack!
(GDB) attach <PID>
(GDB) py-bt
If you use not APT-based Linux, search for proper instruction here.