Emergency: Cleaning the Active Queue

January 7, 2010 Troubleshooting

What do you do when you massive overload of unwanted mail that is coming to your server?  Recently I saw a Postfix Mail server that had gone down some months ago but had 10s of thousands of email ready to  be sent.  When it was repaired it began sending tons of old mail….mail that was simply not needed to send any longer. This is a situation where you need to solve things fast.

The mailq command showed many thousands of mail being sent out.  When the deferred queue was examined it was clear….all the mail was in the active queue.  It looked something like this:

[root@mail postfix]# ls active/
001072081CF  289032080DA  50C8B2081EE  7D8B6208169  A3B14208235  CAD4F20823A
007D9208259  28D1E2080F5  50F662081BA  7DEEB20813A  A3D0920813F  CBC242081AE
009D82080EF  2A7C3208199  51FD020822B  7E24A208283  A3D1C208251  CC806208109
00CD9208274  2B02520812C  549E7208134  7EE6F208266  A4137208104  CCC81208125
01ED5208222  2B1B420825F  54B4A208183  7EEF3208213  A48A02081FA  CD05E2080EC
02BB420815D  2B2BF208209  551A42080FA  7F5492081F4  A58B1208120  CE523208191
0341F208110  2BB272081E9  569992081EF  7FFA8208150  A627D20816C  CE564208145
034C4208174  2CABC208296  56C1520814A  802FC2081D9  A6BC0208288  CEAE2208256
0388C20823F  2CFC820817B  56C4E208249  8209A2081F5  A6F7F208218  CF33320826F
041CA208194  2D11F207BC3  56C7820819F  826D52081A4  A7B112081C5  CFDA2208144
046AC208195  2D6B8208279  56F792080E0  82D05208100  A82832081AA  CFEB72081D2
04A792081B4  2ED842080DB  5757520829A  8305F208231  A8F4B208140  D00B920828D
05366208205  2F2FB2080F6  57EE520822C  83304208188  AA6B52081FB  D05C520821D
05BC320812B  2F32420817C  57FBF208165  84BB4208151  AA6EA20818C  D2D632081AF
064F4208147  2FCE520820A  58B372081BB  8536620811C  AA9C92080E9  D35ED2080A7
065782080D7  30C4B20812F  5995E2081F0  853B3208267  AAB0E208252  D3603208200
066922081D0  32145208245  59C5C20827F  859CD207BB6  AAD5B208219  D4CBB20810A
066A020825A  324CF208260  5D28E20822D  85C312080E4  AB15E2080CD  D4FF02080ED
067F7208273  324DB20817D  5D6A1208264  861D6208214  AB2CD208289  D55AA2081DF
075722080F0  3285220819A  5DC22208280  862C220813B  AB5AF208121  D5805208159
09D6120815E  3291320820B  5DE27208118  86C6E2081C0  AC639208105  D5950207BC2
09DB6208293  32AF3208149  5DE4B2081D5  877C620824E  ACE222081C6  D63E7208126

The solution, though it is dangerous, was to delete all mail in the active queue as it was considered safer to get rid of all mail than to send thousands of old email to other servers.

rm -f /var/spool/postfix/active/*

This should only be considered a last resort, but …nice to have the option when needed.

Tags: ,

Comments are closed.