See stacktrace of hanging Python in futex(..., FUTEX_WAIT_BITSET_PRIVATE|...)
<p>A Python process hangs in futex():</p>

<pre><code>root@pc:~# strace -p 9042
strace: Process 9042 attached
futex(0x1e61900, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, ffffffff
</code></pre>

<p>I want to see the stacktrace if the hanging process.</p>

<p>Unfortunately ctrl-c does not work :-(</p>

<p>How can I see the stacktrace if Python hangs like this?</p>

<ol>
<li>install the gdb python extensions if needed for your system (see <a href="https://wiki.python.org/moin/DebuggingWithGdb" rel="nofollow">here</a> for example, or look at your distro documentation)</li>
<li>attach gdb to your hung process</li>
<li><p>run</p>

<pre><code>(gdb) py-bt
</code></pre>

<p>instead of regular <code>bt</code> to get the Python backtrace</p></li>
</ol>

python debugging hang futex