See stacktrace of hanging Python in futex(..., FUTEX_WAIT_BITSET_PRIVATE|...)
Asked Answered
A

1

6

A Python process hangs in futex():

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

I want to see the stacktrace if the hanging process.

Unfortunately ctrl-c does not work :-(

How can I see the stacktrace if Python hangs like this?

Aurelie answered 15/9, 2016 at 8:48 Comment(2)
Just attach gdb to the process, or run pstack if you have it installed. Or kill -SEGV the process and examine the core, if you don't need to keep it alive.Proponent
@Proponent I want to see the stacktrace of the python code. Not the stacktrace of the Python interpreter (c code). I looked at pstack, AFAIK pstack prints the latter.Aurelie
P
6
  1. install the gdb python extensions if needed for your system (see here for example, or look at your distro documentation)
  2. attach gdb to your hung process
  3. run

    (gdb) py-bt
    

    instead of regular bt to get the Python backtrace

Proponent answered 15/9, 2016 at 9:32 Comment(1)
After doing the ln -s ... commands from another answer, and running gdb as root it worked. Here the other answer: https://mcmap.net/q/623770/-how-to-use-gdb-python-debugging-extension-inside-virtualenvAurelie

© 2022 - 2024 — McMap. All rights reserved.