I have a Python application that I am developing on Windows. I need to investigate a complaint that my app consumes 100% CPU when running in Linux.
I was able to reproduce the issue by:
- Running a Docker container based on Debian (
python:3.9.13-buster). - Cloning my git repo into the container.
- Building my app (
poetryftw) and running it. - Running
topto see that apythonprocess is indeed consuming 100% CPU (and oddly enough occasionally more).
How do I debug my app in the container to understand which part of my code is misbehaving? Is there a utility that can profile my python program as it's running to pinpoint the offending code?
PS - I've tried using gdb -p <thread_id> and its bt command but I can't make sense of the stack trace printed.