Ayende @ Rahien

It's a girl

MSMQ: Insufficient resources to perform operation.

I run into an annoyingly persistent error on a production server:

System.Messaging.MessageQueueException: Insufficient resources to perform operation.
at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
at System.Messaging.MessageQueue.Send(Object obj)
at ConsoleApplication1.Program.Main(String[] args)

This was generated from the following code:

class Program
{
static void Main(string[] args)
{
try
{
var queue = new MessageQueue(@".\private$\MyQueue");
queue.Send("
test msg");
Console.WriteLine("
success");

}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}

The error was happening on all queues, and persisted even after rebooting the machine. I should mention that we had a runaway message generation, and we have queues with lots of messages currently.  The queue that I was trying to send the message to was empty, however. And there was no reading/writing on the queues.

Nasty issue to figure out, I was pointed to this post, and indeed, suggestion #7 was it, we run over the machine quota for MSMQ, so it started rejecting messages.

No one really thought about it, because we never set the quota, but it seems that by default there is a 1GB quota for the entire machine. This is usually more than enough to handle things, I would assume, but when you run into a convoy situation, bad things will happen.

Comments

RichB
10/23/2009 10:47 AM by
RichB

WinXp does not have these MSMQ machine quotas. Win2K3 and up does. Also, I believe you have to be a domain admin to even see the property pages for MSMQ to edit this setting!

Ronald S Woan
10/23/2009 05:28 PM by
Ronald S Woan

Another good post: http://support.microsoft.com/kb/899612

An additional interesting thing is that I think at least previous to Windows 2008, MSMQ stored or memory mapped messages in the filesystem, so we had a antivirus on a system that didn't have the right exclusions that just tanked performance.

Also you can set quotas for defined inbound queues, but I didn't see how to set them for outbound queues, so I tune the static queue quotas to reserve space under the machinequota limit to accomodate some amount of outbound.

Tyler Burd
10/23/2009 07:54 PM by
Tyler Burd

This bit me, too, when I turned on journaling for certain queues. A few weeks later everything suddenly stopped working because the journal also apparently contributes to the 1GB limit. Ugh.

Chris Ortman
10/24/2009 01:15 AM by
Chris Ortman

Was it a bunch of DateTime messages? I ran this once as well and that was what was happening. Never did figure out why all those messages got sent tho

Comments have been closed on this topic.