MSMQ - Generic System.Messaging.MessageQueueException - no error message

3

We have an application in which there are three separate MSMQ queues we are peeking/receiving asynchronously. These queues are continuously peeked(every 2s) to check for new messages. If one is peeked successfully it receives the message to pull it out of the queue. The queues are private on a remote server and the client connects on a path like so: FormatName:DIRECT=OS:servername\Private$\qname

Recently one of our environments started receiving MessageQueueExceptions unceasingly while trying to peek the queues. The peek code looks something like this:

   var messageQueue = new System.Messaging.MessageQueue(path);
   message = _messageQueue.Peek(_config.QueFetchTimeout);

The exception is as follows:

System.Messaging.MessageQueueException (0x80004005)
   at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()
   at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, CursorHandle cursorHandle, IntPtr transaction)
   at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
   at System.Messaging.MessageQueue.Peek(TimeSpan timeout)
   at Run() in C:\workspace\ourclass.cs:line 53

Additional member values:

  1. ErrorMessage: (Empty)
  2. MessageQueueErrorCode: Generic
  3. ErrorCode: -2147467259

Notice that there is no error message for this exception. I haven't been able to find anything on what this exactly entails; it just appears to be a general failure.

Another important note is that this error only seems to occur when there are multiple threads executing peeks on their separate queues. When there is only one queue running continuously the peeks are successful. Other environments are not seeing this issue. This issue has also arisen out of the blue without any changes to the queuing code.

No errors in the OS's event log. EnableConnectionCache is false

The machine works perfectly with local private queues. It only seems to be an issue when they are remote.

Windows 2012R2 MSMQ: 6.3

Are there any ideas as to what have may caused this?

Update:

As OP stated the issue does not exist when only a single thread is running peeks in the application. So the next obvious thing was to lock the peek operation between all threads. Indeed this workaround solved the issue however I am still looking for an answer as to why the peek could not handle the multiple threads on one particular machine running Windows 2012R2 and why the error was so uninformative

c#
.net
asynchronous
message-queue
msmq
asked on Stack Overflow Dec 17, 2016 by Strake • edited Dec 19, 2016 by Strake

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0