Symptoms:
Errors just after posting a message, on a random and very occasional basis:
- "Content Encoding Error" (with output compression turned on)
- "PHP Notice: in file /includes/functions_messenger.php on line 798: include() [function.include]: Failed opening './cache/queue.php' for inclusion" (with output compression turned off)
Diagnosis:
It appears to be caused by a race condition, where the locking system for queue.php doesn't work accurately enough: one process seems to delete the file in the time gap between where another process checks for its existence and then tries to include it. Wrapping the include() inside another file_exists() test didn't fix the problem on my machine. I can't think of any other reason why a file doesn't exist for the include() when it did exists a few lines earlier in the code.
Requirements to reproduce:
- Message queue length non-zero
- Two people posting messages that result in email notifications via the message queue at almost exactly the same time.
Which basically means that this only occurs on a well-used and busy forum with many message notification requests. My forum serves 1.6 million pages per month, an average rate of a page per second (so perhaps two pages or more per second during busy times).
Workaround:
Disabling the message queue by setting "E-mail package size:" to zero has completely fixed the problem.
Suggested fix:
Rather than deleting the queue.php file, perhaps the same effect could be arranged by just emptying it. The whole locking process probably needs careful inspection, though, as there are suggestions that this also sometimes results in unsent notification messages (which my board also suffered from, apparently).
- caused
-
PHPBB-9884 Massive email delays
- Closed
-
PHPBB-10602 A bug in mail queue processing
- Closed
- is related to
-
PHPBB-10103 Fix remaining usage of flock() by converting it to use the lock class
- Closed