Unix message Queue

Hi,
I am working closly with unix message queues i have encountered the following -
after creating the Q and start working with it (pushing & pulling) i receive the following stange parameters on the q's -
STIME=no_entry
Qnum=0
CBYTES=4140

when this happens, the Q is disabled (meaning i can not approach it by any way)

can anyone help ?

Thanks In Advanced
Kel

P.s
The same phonomenen is created on all the Q's i am working with.

I don't understand what you are attempting nor what error you think you might be experiencing.

Ironically, the only part of your post that I decipher are the parameters that you find strange.

Your message queue is 4140 bytes long, the number of messages on the queue is zero, and the time of the last message send is... well, you never have sent a message to this queue.

Why is that strange? What is pushing and pulling? Do you mean push/pop as with a stack? How do you think you can do that? What does disabled mean? How do you approach a queue?

Hi,
Thanks for your replay.

I'll try to be more clear -

  1. i have created the Q as follow:
    'o_qid = msgget(IPC_PRIVATE,IPC_CREAT|0777|IPC_EXCL|S_IRUSR|S_IWUSR);'

And worked with the Q as follow:
'msgsnd( qid, (void*)(&eventDataBuffer), MessageSize, 0) '
'qbytesread=msgrcv(qid, (void*)pMessage, max_msgsize, -MSGTYPE_MAX_APP_RANGE, 0)'

  1. The Q has functioned OK for about an hour, where data was surely sent & received.

  2. On a certain point, i could not send, nor receive from the Q.
    The parameters on the Q where:
    Qnum=0 (The number of messages currently outstanding on the
    associated message queue.)
    CBYTES= ~4k (The number of bytes in messages currently outstanding on the associated message queue.)

This is what i do not understand. How come there are no messages, and the Q inform me that the data size is greater than 0?

I hope i made more clear.
Thanks Again.

Hmmm....you do have a point. I was getting CBYTES mixed up with QBYTES.

I agree, for the most part, QNUM = 0 and CBYTES != 0 is not consistent. But I can think of one exception where it might make sense. When you do your msgsnd, you are setting msgflg to zero. That means that IPC_NOWAIT is turned off. The msgsnd system call checks to see if this message would exceed some limits. This includes a check of the message queue you are using as well as some system wide limits. If a msgsnd would exceed a limit and it did not set IPC_NOWAIT, the msgsnd system call will suspend until it is safe to send the message. I don't know what state the message queue is in during this suspension. It could well be that CBYTES has been increased but QNUM has not yet been incremented.

This would explain why it works for a few hours and then locks up. Reproduce the error and then run "ipcs -qa" and compare the total messages queue resources in use against your kernel parameters. If this is the problem, you will need to increase the kernel parameters. Or you may have a message queue leak somewhere.

That is my only idea. If it's not that, I would next suspect a broken kernel. You might check for any appropiate patches.