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.

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.

share|improve this question
add comment

1 Answer 1

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.

IHTH

share|improve this answer
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.