You can try enabling faulthandler. Set environment variable (export) PYTHONFAULTHANDLER to something, say, foobar. When it gets stuck you can send SIGABRT and should get a proper stack trace where it get stuck. Cheers, Marian