How to debug when bash hangs? I have a script running on an ARM64 linux with bash. It hangs after running for a few hours. pstack shows nothing. strace shows nothing either. I cannot stop the process even with kill -9. What else can I do with it to debug? Any suggestions will be appreciated.
Asked
Active
Viewed 163 times
0
-
Can you include the script? – cam Mar 05 '22 at 00:27
-
If you can't kill a process with `kill -9` then it's either stuck in a kernel syscall, which indicates a kernel bug or a hardware problem, or it's a [zombie](https://stackoverflow.com/questions/16944886/how-to-kill-zombie-process): it's exited and its *parent process* hasn't reaped it. If it's the latter forget about the child; you need to investigate the parent. – John Kugelman Mar 05 '22 at 00:27
-
2How do you know its hanging as opposed to done? Can you re-run it with `bash -x`? – Ed Morton Mar 05 '22 at 00:42
-
3Do you know what command it's executing (or trying to execute) when it hangs? You can get a trace of what it's executing by putting `set -x` at the beginning of the script (or running it with `bash -x scriptname`). If it runs in the background (or you just don't want the trace filling up your terminal window), you can redirect stderr to a file. – Gordon Davisson Mar 05 '22 at 01:22