Process – Information About Eventpoll on a Running Thread

processthread

Following on from a problem described in "How is it that I can attach strace to a process that isn't in the output of ps?"

I'm trying to debug a process that hangs part way through.

By using strace -f on my parent process, I was able to determine that I have a bunch of threads that are just showing:

# strace -p 26334
Process 26334 attached - interrupt to quit
epoll_wait(607, {}, 4096, 500)          = 0
epoll_wait(607, {}, 4096, 500)          = 0
epoll_wait(607, {}, 4096, 500)          = 0
epoll_wait(607, {}, 4096, 500)          = 0
epoll_wait(607, ^C <unfinished ...>
Process 26334 detached

Investigating further:

# readlink /proc/26334/fd/607
anon_inode:[eventpoll]

My gut tells me that I've managed to get some threads in a deadlock situation, but I don't really know enough about epoll to move forward. Are there any commands that can give me some insight into what these threads are polling for, or which file descriptors this epoll descriptor maps to.

Best Answer

When you run strace the lines it's returning are system functions. In case it wasn't obvious epoll_wait() is a function that you can do a man epoll_wait to find out implementation details like so:

   epoll_wait, epoll_pwait - wait for an I/O event on an epoll file descriptor

The description for epoll:

The epoll API performs a similar task to poll(2): monitoring multiple file descriptors to see if I/O is possible on any of them. The epoll API can be used either as an edge-triggered or a level-triggered interface and scales well to large numbers of watched file descriptors.

So it would seem that you're process is blocking on file descriptors, waiting to see if I/O is possible on any of them.

I would change my tactics a bit and try and make use of lsof -p <pid> to see if you can narrow down what these files actually are.

Related Question