How to find out what process is consuming pending signals

signals

A user is getting the following message when they try to run a particular program.

timer_create: Resource temporarily unavailable

From this StackOverflow Q&A titled: timer_create() : -1 EAGAIN (Resource temporarily unavailable), I discovered that this has to do with running out of space for pending signals. I confirmed this using a separate user account by running this command:

$ ulimit -i 0

and checking that I get the same error, which indeed I do. With this command:

$ ulimit -i 1

or any higher amount there is no error.

When the original user runs ulimit -i they get 127368. Thus I concluded that they had run out of space for pending signals somehow.

What is going on? Does it mean that one or more running programs has consumed these? If so how do I find out which ones?

Best Answer

Well, this isn't a pretty solution, but at least it might be a solution.

In /proc/[pid]/status there is an entry for SigPnd and ShdPnd. They are described as,

SigPnd, ShdPnd: Number of signals pending for thread and for process as a whole (see pthreads(7) and signal(7)).

There's also SigQ which is,

SigQ: This field contains two slash-separated numbers that relate to queued signals for the real user ID of this process. The first of these is the number of currently queued signals for this real user ID, and the second is the resource limit on the number of queued signals for this process (see the description of RLIMIT_SIGPENDING in getrlimit(2)).

(All of this is from man 5 proc).

So you could search all the pid's in /proc, check their status files, and find the one with any pending signals.

Try this,

cd /proc

find . -name "status" | xargs grep SigPnd 2> /dev/null | grep -v "0000000000000000"

and

find . -name "status" | xargs grep ShdPnd 2> /dev/null | grep -v "0000000000000000"

Related Question