Insufficient Resource Error on msgsnd Call
Kenneth Almquist
ka at june.cs.washington.edu
Thu May 25 10:23:24 AEST 1989
> +--------+ +--------+ +--------+
> | | +-----+ | | +-----+ | |
> | Proc A |---->>| Q 1 |-->| Proc B |---->>| Q 2 |-->| Proc C |
> | | +-----+ | | +-----+ | |
> +--------+ +--------+ +--------+
This setup can deadlock if the value of msg_qbytes for queue 1 is too
large. The sequence of events is:
0) Queue 2 is empty.
1) Process B reads a message from queue 1.
2) Process A writes lots of messages to queue 1, exhausting the global
message buffer space.
3) Process B tries to write a message to queue 2, but can't because
the global message buffer space is exhausted.
If this is your problem, then you can fix it by limiting the quantity of
messages outstanding on queue 1 to prevent the global message buffer space
from being exhausted. (This is done by using the IPC_SET command of the
msgctl system call to set msg_qbytes to a smaller value.)
On the other hand, you write:
> Queue 2 looks empty because Process C is blocking on it (using
> msgsnd with IPC_WAIT) ...
> reading Queue 2 several times breaks the log jam and the system runs
> for a while ...
If you can read messages off of queue 2 while process C is blocked on a
read, that indicates a kernel bug. Probably the msgsnd system call is
failing to call wakeup for some reason.
Kenneth Almquist
More information about the Comp.unix.questions
mailing list