2

A coworker ran into this issue twice and I don't know what's wrong. His ps command hangs, taking about 25% of the CPU.

   in_progress=1
   sleep 10

   while [ "$in_progress" -eq 1 ]; do
      num_isp=`ps -e | grep isputility | grep -v grep | wc -l`
      if [ "$num_isp" -eq 0 ]; then
         in_progress=0
      fi
      sleep 10
   done

Below is the output of the ps command that hung.

       F S   UID        PID       PPID  C PRI  NI ADDR    SZ WCHAN STIME TTY          TIME CMD
00100000 -     0   35672094    1204253  -  10   0    -  844K -     Apr16 ?        00:00:00 /bin/sh /home/customProgram
00100000 -     0   43548705   42545184  -  10   0    -  648K -     11:51 ?        00:00:00 ps โ€“elf
00100000 -     0   41926696   35672094  -  10   0    -  648K -     Apr16 ?        03:53:01 ps -e
00100000 -     0   41926702   35672094  -  10   0    -  672K -     Apr16 ?        00:00:00 grep isputility
00100000 -     0   41926704   35672094  -  10   0    -  672K -     Apr16 ?        00:00:00 grep -v grep
00100000 -     0   41926706   35672094  -  10   0    -  640K -     Apr16 ?        00:00:00 wc -l

Running QNX hogs command (similar to top) shows ps is using ~25% of the CPU.

hogs -% 1 -n
PID             NAME  MSEC  PIDS SYSTEM
1            procnto  2116   71%    70%
41926696           ps   763   25%    25%

Can anyone point us in the right direction to figure out why ps hung and what we can do about it?

kmort
  • 724
  • 1
  • 8
  • 19
  • 2
    you might want to look at [Why does my system hang when I run ps, w and possibly other commands?](http://superuser.com/q/250554/144040) โ€“ Anthon Apr 18 '13 at 20:19
  • those `TTY=?` outputs are suspicious, particularly since these look like commands that are clearly actually on a tty. It's possibly looping through something trying to find the tty and then giving up. โ€“ Random832 Apr 19 '13 at 12:47

1 Answers1

2

Try executing strace ps and see what system call it is hanging on and then take action accordingly.

mdpc
  • 6,736
  • 3
  • 32
  • 46