Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9061

Race condition in queue locking

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.0.8-RC1
    • 3.0.6
    • Other
    • None

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

            ToonArmy Chris Smith
            fonant fonant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: