1

I have a private, non-transactional message queue running on Win2008 R2. The queue breaks when I do the following:

  1. Place a recoverable message on a queue like so:

    Message msg = new Message
    {
      Body = "hello",
      Formatter = new XmlMessageFormatter(),
      Label = "Notification",
      Recoverable = true,
      AppSpecific = 123
    };
    
    mq.Send(msg);
    

    Do not retrieve the message!

  2. Restart the Message Queue service
  3. The service does not successfully restart. The following message is logged in the Event Viewer:

    The Message Queuing service cannot start because a queue is in an
    inconsistent state. For more information, see Microsoft Knowledge
    Base article 827493 at support.microsoft.com.
    

Points to note:

  • A message added to the queue this way can be successfully retrieved from the queue before restart.
  • The only way I can get the queue running again is to follow these instructions: MSMQ Inconsistent State After Restart but this obviously prevents message recovery.
  • If I leave Message.Recoverable = false then the service restarts successfully. But I want my messages to survive a service restart.
  • I get exactly the same behaviour when I set the queue as Transactional.

Any ideas?

Community
  • 1
  • 1
masty
  • 1,539
  • 1
  • 17
  • 20
  • I have the exact same issue :( My messages were created using WCF, but were Recoverable too. – tommed Oct 03 '13 at 20:56

3 Answers3

4

Give your machine name less than 15 characters then it will works. This is due to Netbios names can only be 15 characters or less. This was causing problems with the MSMQ Service as a result it was ending up in the inconsistent state as specified in the error. To fix this issue, uninstalled MSMQ, renamed the machine to something smaller than 15 characters and then reinstalled MSMQ. This resolved the issue.

NMehta
  • 56
  • 4
  • This solved it for my case. Sad that real solutions to difficult and undocumented problems miss upvotes because they aren't popular. In my case, I just needed to shorten the server name and restart, and MSMQ recovered. – mukunda Mar 25 '21 at 20:42
1

Sounds like something is interfering with the storage files. Recoverable (which includes transactional) messages are written to files in the MSMQ\Storage directory as well as being mapped into memory. On startup, the files are reloaded to recreate the messages mapped into memory. For some reason these storage files don't work anymore.

Things I would look for:

  • Any other software that has access to the system32\msmq directory tree, such as Anti Virus products. Block these products from the directory tree.
  • Is storage on a locally attached disk or a network drive (e.g. SAN); if not local try reconfiguring MSMQ to use the local disk.
  • Is the disk error-free? Run chkdsk or similar.
  • If you create a new provate queue, does the problem affect that too?

Cheers
John Breakwell

John Breakwell
  • 4,667
  • 20
  • 25
  • Thanks for the quick reply, I've checked everything you suggested and still no luck: No such software running (watched with Procmon) / It's on a local disk / Chkdsk reports no errors / A new private queue behaves the same. Any other ideas? – masty Jul 15 '11 at 01:16
  • Nope. I'd recommend raising a case with Microsoft support. – John Breakwell Jul 24 '11 at 18:41
1

Try moving the msmq dirctory to a different location. Maybe there is a permission problem on the disk.

Igal Serban
  • 10,558
  • 3
  • 35
  • 40