Quick Linux Tip #127:
Question: A process is hung. Where is it stuck in the code?
Try: sudo cat /proc/3456/stack
Info: Displays kernel stack traces and wait channels to pinpoint where processes are blocked.
Examples:
- $
sudo cat /proc/*/wchan 2>/dev/null | sort | uniq -c | sort -rn# Analyze wait channels system-wide - $
sudo ps axo pid,stat,wchan,comm | awk '$2 ~ /D/'# List all processes stuck in uninterruptible sleep - $
sudo pystack dump 3456# Generate a detailed Python-specific call stack dump
Note: Processes in the D state (uninterruptible sleep) typically indicate I/O waits, whereas futex_wait signifies a mutex lock. Sample processes multiple times to verify if execution is progressing.
Leave a Reply