XF 2.2 xf_mail_queue made system run out of disk space and crash

Nicky Vermeersch

Active member
Hello, recently I noticed the VPS we use for our forums crashed and upon investigation the system had no disk space whatsoever. xf_mail_queue somehow used all the remaining disk space and caused mariadb to crash and the webserver.

I couldn't truncate the xf_mail_queue table as that requires the mariadb service to run, which was not possible due to no free space. I had to hard delete the xf_mail_queue.idb

How can I recreate the xf_mail_queue table? For now the forum works but the mail_queue table is bugged (Unable to select the table: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB)
 
For posterity, I was able to view and copy the blank table from a previous backup. In order to recreate the xf_mail_queue table, the following sql query has to be run:

SQL:
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

DROP TABLE IF EXISTS `xf_mail_queue`;
CREATE TABLE `xf_mail_queue` (
  `mail_queue_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mail_data` mediumblob NOT NULL,
  `queue_date` int(10) unsigned NOT NULL,
  `send_date` int(10) unsigned NOT NULL DEFAULT 0,
  `fail_date` int(10) unsigned DEFAULT NULL,
  `fail_count` int(10) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`mail_queue_id`),
  KEY `send_date_queue_date` (`send_date`,`queue_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
Interestingly enough, once the table was recreated and I checked a few hours later, the mail queue had already thousands of mails waiting in the queue. All the mails in the queue were destined to the same user (using a @gmail.com account). There seems to be a logic loop somewhere that keeps trying to send the email.

I'm also rather amazed by the fact I reached the Google daily sending quota (2000 mails) as I usually only use about 100 per day.
 
It seems the issue is related to the automatic bounce handler.
I was using an email address set as default for board notifications, and I set up an email address dedicated to just bounced mails (as indicated in the instructions).

When I disabled the automatic bounce handler, the errors stopped, and the system didn't try to send a load of duplicate messages.
 
Top Bottom