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)

Nicky Vermeersch

Active member
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:

SET time_zone = '+00:00';
SET foreign_key_checks = 0;

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`)

Nicky Vermeersch

Active member
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.

Nicky Vermeersch

Active member
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.