ipc-message queue problem

ipc-message queue problem

Post by claud » Sat, 22 Jun 2002 02:45:51

I've written a simple program to test ipc with a message queue.
I get a new queue id, then fork some other processes. The parent
(server) puts a separate message in the queue for every client (with a
different message type to identify clients).
Clients are supposed to remove their own messages from the queue, then
pack a response and put it back on the queue with a msg type of 1 (to
identify the server).
The server should then process client input and repeat the whole loop
(send msgs to clients, wait for answers, process input...)

The problem is that all the clients hang when trying to get a message
(via msgrcv). ipcs shows that clients have removed their messages from
the queue (byte used and messages to 0), so how could it be that
msgrcv doesn't return?
I know that messages are correctly sent by the server, because
removing msgrcv in clients let me show that the queue is loaded with
the right number of bytes.
Thanks for any hint,


ipc-message queue problem

Post by claud » Sun, 23 Jun 2002 02:14:38

Well, it was a silly problem, unrelated with the message queue. Just
in the case someone started turning it over in his mind...


1. IPC (message queues ) problem - HELP !!!! URGENT !!!


I am using IPC mechanism to excahnge data between a CGI process and the
backend daemon process.
While using msgsnd()  I always get EINVAL - which is invalid message id for
msgsnd() !  I even tried to put the absolute value ( after first starting
the daemon process and finding out its mesg_id ) in the msgsnd() call - but
it always gives me same error.  I even printed the mesg_id value just
before calling msgsnd() - everything looks fine but the system call fails.

But the funny thing is if I write an independent program ( without any CGI
related stuff ) - then the IPC seems to work.  Is there any relationship
between the CGI stuff and the mesg_id variable getting corrupted ?? I have
of course verified any stray pointers or memory leaks.

I am using Solaris.

Any help is greatly appreciated !


Arvind Sharma
Lucent Technologies, Ohio, USA

2. linux on partition beyond 1024 cylinders?

3. IPC (message queues) problem - HELP !!! URGENT !!!!

4. get hardware status of mainboard?

5. IPC ( messaging queue) problem HELP !!! URGENT !!!!

6. Hardware RAID solutions for Solaris Servers...

7. Are UNIX IPC message queues bad?

8. Starting X on Redhat Linux 4.1 on HP Vectra XU causes spontaneous rest

9. IPC: message queue

10. IPC message queues

11. If a process is blocked in IPC message queue msqid_ds.wwait or rwait ... ...

12. IPC with shared memory and message queues?

13. IPC queues : Number of messages