1

I'm trying to run a command on OSX Mavericks and it seems to be hanging. I found out that Control + T is a Unix command to show the status of a foreground job. Pressing it several times over the course of several minutes gives me:

$ bin/rake                                                                                
load: 3.68  cmd: ruby 55761 waiting 0.12u 0.02s
load: 3.47  cmd: ruby 55761 waiting 0.12u 0.02s
load: 3.47  cmd: ruby 55761 waiting 0.12u 0.02s
load: 3.09  cmd: ruby 55761 waiting 0.12u 0.02s
load: 2.41  cmd: ruby 55761 waiting 0.12u 0.02s
load: 4.38  cmd: ruby 55761 waiting 0.12u 0.02s

I understand this to mean that the status is "waiting", it has spent .12 seconds of user time and only 0.02 seconds of CPU time executing.

I want to find out why it's stuck waiting. How can I determine why a process is waiting?

2
  • In this case, I was able to press Control + C to interrupt the process, and a stack trace showed me it was trying to read from a socket which presumably was never written to. But I'm still curious if there are other ways to determine this. Jul 3 '14 at 16:16
  • If you do something like ps -u, that will show the command that coordinates to each PID
    – ryekayo
    Jul 3 '14 at 16:20
1

Run dtruss to see what system calls a process is making:

dtruss -p55761

This will tell you what system call the process with PID 55761 is currently engaged in. If that system call accesses some file descriptor, lsof will tell you what file is open there.

lsof -p55761

If the file is a pipe or socket, I don't know how to find what if anything is on the other side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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