Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

After some bad performance today, I checked top:

 1  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  14229 myuser    20   0  8776 5264 1684 R   99  0.2   1383:47 bash

98-100% use by a Bash process which should have died a long time ago (I just closed all terminals to verify it)? I'm not sure what's causing it.

$ lsof -p 14229
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
bash    14229 myuser  cwd    DIR   0,23     4096 11059271 /home/users/myuser (company.com:/home/users/)
bash    14229 myuser  rtd    DIR    8,2     4096        2 /
bash    14229 myuser  txt    REG    8,2   920788  7617113 /bin/bash
bash    14229 myuser  mem    REG    8,2    30520   657679 /lib/i386-linux-gnu/libnss_compat-2.15.so
bash    14229 myuser  mem    REG    8,2    13940   657672 /lib/i386-linux-gnu/libdl-2.15.so
bash    14229 myuser  mem    REG    8,2  1713640   657666 /lib/i386-linux-gnu/libc-2.15.so
bash    14229 myuser  mem    REG    8,2   121024   660635 /lib/i386-linux-gnu/libtinfo.so.5.9
bash    14229 myuser  mem    REG    8,2    47040   657683 /lib/i386-linux-gnu/libnss_files-2.15.so
bash    14229 myuser  mem    REG    8,2    42652   657690 /lib/i386-linux-gnu/libnss_nis-2.15.so
bash    14229 myuser  mem    REG    8,2   134344   657659 /lib/i386-linux-gnu/ld-2.15.so
bash    14229 myuser  mem    REG    8,2    92016   657678 /lib/i386-linux-gnu/libnsl-2.15.so
bash    14229 myuser  mem    REG    8,2  2919792  7748495 /usr/lib/locale/locale-archive
bash    14229 myuser  mem    REG    8,2    26256  7757442 /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
bash    14229 myuser    0r   CHR  136,1      0t0        4 /dev/pts/1 (deleted)
bash    14229 myuser    1w   CHR  136,1      0t0        4 /dev/pts/1 (deleted)
bash    14229 myuser    2w   CHR  136,1      0t0        4 /dev/pts/1 (deleted)
bash    14229 myuser  255u   CHR  136,1      0t0        4 /dev/pts/1 (deleted)

Except for the /dev/pts lines this is identical to other bash processes:

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
bash    6674 myuser  cwd    DIR   0,23     4096 11059271 /home/users/myuser (company.com:/home/users/)
bash    6674 myuser  rtd    DIR    8,2     4096        2 /
bash    6674 myuser  txt    REG    8,2   920788  7617113 /bin/bash
bash    6674 myuser  mem    REG    8,2  1713640   657666 /lib/i386-linux-gnu/libc-2.15.so
bash    6674 myuser  mem    REG    8,2   121024   660635 /lib/i386-linux-gnu/libtinfo.so.5.9
bash    6674 myuser  mem    REG    8,2    47040   657683 /lib/i386-linux-gnu/libnss_files-2.15.so
bash    6674 myuser  mem    REG    8,2    13940   657672 /lib/i386-linux-gnu/libdl-2.15.so
bash    6674 myuser  mem    REG    8,2    30520   657679 /lib/i386-linux-gnu/libnss_compat-2.15.so
bash    6674 myuser  mem    REG    8,2    42652   657690 /lib/i386-linux-gnu/libnss_nis-2.15.so
bash    6674 myuser  mem    REG    8,2    92016   657678 /lib/i386-linux-gnu/libnsl-2.15.so
bash    6674 myuser  mem    REG    8,2   134344   657659 /lib/i386-linux-gnu/ld-2.15.so
bash    6674 myuser  mem    REG    8,2  2919792  7748495 /usr/lib/locale/locale-archive
bash    6674 myuser  mem    REG    8,2    26256  7757442 /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
bash    6674 myuser    0r   CHR  136,2      0t0        5 /dev/pts/2
bash    6674 myuser    1w   CHR  136,2      0t0        5 /dev/pts/2
bash    6674 myuser    2w   CHR  136,2      0t0        5 /dev/pts/2
bash    6674 myuser  255u   CHR  136,2      0t0        5 /dev/pts/2

Standard kill doesn't work:

$ kill 14229 && sleep 1m && kill -0 14229 && echo Alive
Alive

According to ps wafux it has no child processes.

Tried tracing it as recommended by @ChandraRavoori:

$ sudo strace -p 14229
Process 14229 attached - interrupt to quit

After that I get no output. I tried to kill 14229 multiple times, and it just printed the following every time:

--- SIGTERM (Terminated) @ 0 (0) ---

What are other things to check before kill -9?

share|improve this question
2  
how about running strace on the pid? –  1_CR Sep 25 '12 at 15:38
    
Good suggestion @ChandraRavoori; updated the question. –  l0b0 Sep 25 '12 at 15:44
3  
You could try attaching gdb to it, if you want to debug. Other than that, just kill -9 it. –  derobert Sep 25 '12 at 16:02
3  
/home/users/myuser looks like it's on an NFS mount, so the bash process is probably stuck with a stale NFS handle for its cwd. was your NFS server unreachable for a while? –  cas Sep 25 '12 at 23:07
    
because strace does not produce any output I would expect that the process is blocked in a system call. Togehter with the observation of @CraigSanders I would also think this is an nfs related problem. –  miracle173 Sep 26 '12 at 6:06
add comment

2 Answers

Try

strace -p 14229

I will print every syscall that the process invokes. Then you see what the process actually does.

http://try-linux.blogspot.de/2013/12/how-to-strace-process.html

share|improve this answer
add comment

Dont know if you have already tried it but
ps xal, it can give you the parent process id,

You can kill the parent to recover from it.

PS: usually bash has the init process as parent. if thats so here too, then only the standard solution, Ctrl + Alt +del (or reboot) can only resolve it.

share|improve this answer
4  
Huh I didn't knew Linux admins considers restarting the standard solution.... –  Thihara Oct 15 '13 at 5:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.