views:

184

answers:

1

I'm using message queues for inter-thread communication in a server. The server was functioning as expected on Thursday evening. When I picked the project back up on Monday, it was unable to create two of the six queues in use, citing that they were already open (O_EXCL is set). This should not have been the case, but nevertheless I added an mq_unlink call with error checking and removed the O_EXCL flag from mq_open.

When I compiled and ran, the errno was set to EEXIST by both mq_unlink and mq_open. This should be a can't happen: mq_unlink can't set errno to EEXIST under any circumstances, and mq_open can only set EEXIST when the O_EXCL flag is set.

Any ideas why this is happening?

+1  A: 

I believe that this is a Solaris bug. Check for a lock file (usually /var/tmp/.MQL/...) and remove it if you know the message queue is not in use. That should allow the unlink to succeed.

mark4o
Turns out it resides in /tmp. Deleting the lock file did allow me to access and unlink the queue. Thanks!Further information is available on page 457 of Solaris internals By Mauro and McDougall, available on Google Books.
Sean