I often want to know why a process in the middle of a pipeline is sleeping and not busy processing data. My current method is:

  1. find the pid of interest
  2. sudo strace -pt pid to get the blocking syscall and object (fd, child, futex, etc.)
  3. hit Ctrlc to detach strace
  4. look up the appropriate object in /proc/pid
  5. grep /proc/ or use lsof to find the other end of the pipe or process being waited on
  6. repeat from #1 with the new pid

This is a pretty slow process that combines a lot of tools that don't play well together (strace in particular is hard to automate). Is there a tool that will do this loop for me and plot out the wait chain of a process, or at least make one iteration less awkward?

Linux 3.2, Ubuntu LTS 12, x64, under VirtualBox, if it matters.


most ps s now include a tree option, or a very aptly name related utility, ptree.

As my current work system doesn't have ptree, I currently use

ps fauw 

I think I also had a

ps taux (t making more sense than f)

Finally some ps have options to also include a programs threads in the view.

While this isn't the automated solution you (and I) would wish for, my experience is that there emerges a list of 'likely-suspects' in process trees, and just scanning the tree, you can often guess where the problem is.


  • ptree has nothing to do with wait chains. If a process is blocking, you have no reason to believe that this is because of a child process.
    – Navin
    Nov 14 '17 at 16:55

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.