6

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?

Tom Ellis
  • 253

1 Answers1

3

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"

EightBitTony
  • 21,373
  • No need to crawl all of /proc. Since we're talking about one user here, how about looking for that user's processes and only searching for the status file of those? You can get a list of PIDs for processes started by a single user with ps -u user_name -o pid= – Joseph R. Jul 16 '13 at 21:16
  • That's great, thanks. Actually I already knew this information was available throught ps -eo user,pending,command for example but I didn't know how to interpret it. I have a command which has ShdPnd of 0000000200000000. Do you know what this "bitmap of pending signals" means? Clearly it's not zero, but I don't know how many it is! – Tom Ellis Jul 16 '13 at 21:16
  • @JosephR. you could do that, but the time it would have taken me to work out the ps command to get the numbers, was longer than the time it took find to trawl through the process tree (in my case). – EightBitTony Jul 16 '13 at 21:35
  • @EightBitTony Good. I just think it's wise to qualify your find whenever possible. – Joseph R. Jul 16 '13 at 21:38
  • @TomEllis the text I pasted suggests those aren't signal masks, but counts, however, they would be huge if that was the case so there must be something else going on. – EightBitTony Jul 16 '13 at 21:45
  • 2
    I think there must be a bug in man 5 proc then, because these are definitely not signal counts. man 1 ps makes it very clear they are masks. However, a couple of lines above is SigQ: 127368/127368! So indeed I can see that the signal count has hit its limit, but unfortunately this is a user-wide count -- it's the same for all this user's processes. I still can't tell which process in particular is responsible. – Tom Ellis Jul 17 '13 at 07:29