"Insufficient resources to perform operation." MSMQ when transaction contains multiple messages
Asked Answered
R

3

8

I'm moving an application from one server to another and the new server returns the 'famous' - "Insufficient resources to perform operation." message when the code attempts to send multiple messages to a queue, the process is wrapped inside a transaction (TransactionScope). The old server executes the code correctly and all the messages (150 approx) are sent to the queue as expected, but the new server fails at apporx 27.

Now the message size is small and the number of messages on the queue is zero.

I've read the 'Insufficient Resources? Run away, run away!' article but I'm unsure how to change machine quotas for MSMQ.

The app log has the following entry:

System.Messaging.MessageQueueException (0x80004005): Insufficient resources to perform operation.

Technology is C# & .Net 4.0, server is win 2003 R2 SP2

Any ideas why I'm getting this?

Refreshing answered 16/3, 2011 at 10:3 Comment(5)
If you are only looking at 27 messages causing you problems, setting quotas is NOT where you want to look. Item #4 in my blog post is more likely to be the one you want to investigate.Willner
John, thanks for the heads upRefreshing
It appears one of the messages was greater than the 4 Mb limit, once that was sorted out it appears to be workingRefreshing
My problem was #7 on your blog post. Solved it with the help of your fantastic post! Thanks John.Bonheur
See answer from ChocoSmith below, it has a link to a toolRefreshing
R
8

One of the message was exceeding the 4 Mb limit - once this was sorted everything worked as expected.

Refreshing answered 16/3, 2011 at 12:44 Comment(3)
You definitely want to have checks inside your app to catch that and make sure you keep up with message format changes. blogs.msdn.com/b/johnbreakwell/archive/2007/08/22/… blogs.msdn.com/b/johnbreakwell/archive/2007/06/29/…Willner
John, Thanks, just done that and made sure it can't happen again, it was around the size of an image and the fact we hadn't put an upper restriction or more importantly an image type restriction in...Refreshing
How did you determine you had a message > 4mb?Gittens
S
4

Just to add for issue number #7 storage space and Mitch's Answer.

Your quota size is the physical size on disk and not the queue reported size (as reported in apps like QueueExplorer or performance monitor).

So even though you have purged your queue you haven't actually removed them from disk (its meant to be cleaned every six hours)-

The default location is C:\Windows\System32\msmq\storage , or get it from the 1st link in Mitch's answer.

To clean up you can't just delete the files.

Try the below script (save as myScript.vbs). Run this as administrator from command prompt using:

cscript myScript.vbs

Option Explicit

Dim mqa
set mqa = WScript.CreateObject("MSMQ.MSMQApplication")

WScript.Echo "Bytes in all queues: " + CStr(mqa.BytesInAllQueues)

mqa.Tidy

WScript.Echo "MSMQ cleaned up"

After this our files dropped from 1Gb to about 50 mb even though the bytes in queues reported 40mb.

credit to thread: https://groups.google.com/forum/#!topic/microsoft.public.msmq.performance/jByfXUwXFw8

Smail answered 4/2, 2014 at 16:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.