Overview
MailEssentials utilizes the Microsoft Windows Private Message Queues ( MSMQ ) to cache data which will need to be written into various databases. If MailEssentials fails to write data into a queue three times, it will then put it in the recovery queue which will be re-processed after a restart of the GFI MailEssentials services or of the server.
It is normal that during peak hours when mail flow is high, the number of messages in the queues starts to increase, but return to zero after a short time. There can be instances where messages continue to build up in the midlayermaqueue@*, midlayermaqueue@recovery, midlayerqueue@*and midlayerqueue@recovery queues that are used for holding emails waiting to be written to the dashboard logs.
This article provides the steps needed to purge the above Anti-Spam and Anti-Virus Scan Engine queues when queue message processing fails and the message build-up continues to grow on the above-mentioned queues.
Diagnosis
MailEssentials queues can be accessed by navigating to Start > Run > compmgmt.msc ( Enter ) then to Services and Applications > Message Queuing > Private Queues.
Older versions of MailEssentials have known issues with the MSMQ service which results in delayed writes by middle layer queues which in turn results in the respective recovery queues (midlayermaqueue@recovery and midlayerqueue@recovery) queue growing on the Exchange server.
The end result is processed emails failing to show on the Dashboard logs and the queues themselves showing an unusually high number of messages which remain unprocessed after several minutes.
Solution
This is a known issue with older versions of MailEssentials therefore the recommended fix is to upgrade to the latest release as described in this article on How to Install or Upgrade GFI MailEssentials.
If however, it is not possible to immediately upgrade to the latest release, the following procedure can be carried out to purge the Anti-Spam and Anti-Virus Scan Engine queues.
Note that the midlayermarqueue@* queues hold emails to write to the Dashboard > Logs section. The recovery queue (midlayermaqueue@recovery) is where emails that couldn't be processed by this private queue are added, these might be old entries that were never cleaned up or emails that no longer have temp files to finish the process.
No new emails are lost when clearing that private queue. You can purge midlayermarqueue@* without any risk of losing emails as all emails will still be processed even if they don't show on the Dashboard logs.
Perform the following procedure to purge the Anti-Spam and Anti-Virus Scan Engine queues holding emails waiting to be written to the dashboard:
- Stop the IIS Admin service (or the Microsoft Exchange Transport Service, if installed on a Microsoft Exchange 2007 / 2010 server, and all the dependent services
- Stop the GFI MailEssentials AS Scan Engine and GFI MailEssentials AV Scan engine, and disable them, so they do not restart
- Wait for 30 seconds to ensure that the items in the MSMQ are processed by the GFI Attendant services
- Stop the GFI MailEssentials Managed Attendant Service
- Go to Start > Run > type compmgmt.msc and click OK
- The Computer Management MMC will open
- Go to the Services and Applications node and browse to Message Queuing
- Open the Private Queues
- There should be the GFI MailEssentials queues
- Expand the midlayermarqueue@* and midlayermaqueue@recovery queues and two new nodes will appear, Queue Messages and Journal Messages
- Right-click Queue Messages, select All Tasks > Purge
- A confirmation window will appear
- Press OK to clear all messages in the queue
- Repeat these steps for all the midlayermarqueue@* queues
- This will clear the queues. To check if the messages were cleared, navigate back to Private Queues and press the Refresh icon on the toolbar. The purged queues should show zero items.
- Go to the folder
..GFI\MailEssentials\Antispam\MiddleQueue
and move the files to a safe folder elsewhere. These files will be renamed with the extension .eml and dropped back into the Microsoft Exchange Pickup folder to be reprocessed later. - Go to the folder
..GFI\MailEssentials\EmailSecurity\MiddleQueue
and move the files to a safe folder elsewhere. These files will be renamed with the extension .eml as well and dropped back into the Microsoft Exchange Pickup folder to be reprocessed later. - Restart the services stopped in steps (1), (2) and (4)
Confirmation
- Go to Start > Run > type compmgmt.msc and click OK to launch the Computer Management snap-in
- Go to the Services and Applications node and browse to Message Queuing
- Open the Private Queues and inspect the midlayermarqueue@* queues which should not be having any unprocessed messages build-up.
- Confirm that emails processed by MailEssentials are now appearing on the Dashboard logs under GFI MailEssentials > Dashboard > Logs