Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9061

Race condition in queue locking

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.6
    • Fix Version/s: 3.0.8-RC1
    • Component/s: Other
    • Labels:
      None

      Description

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

      1. ticket-57515.diff
        4 kB
        Oleg [X]
      2. ticket-57515-chmod-fix.diff
        0.5 kB
        Oleg [X]
      3. ticket-57515-chmod-opt.diff
        0.8 kB
        Oleg [X]

        Issue Links

          Activity

          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          Bump?

          Show
          Oleg Oleg [X] (Inactive) added a comment - Bump?
          Hide
          ToonArmy Chris Smith added a comment -

          I'd appreciate testers of this fix.

          Show
          ToonArmy Chris Smith added a comment - I'd appreciate testers of this fix.
          Hide
          bantu Andreas Fischer added a comment -

          http://github.com/cs278/phpbb3/commit/2e7b972ec26c851ebfdc8deb43eeebf4e5ffea36 should have "PHPBB3-9061" instead of "PHPBB-9061".

          Show
          bantu Andreas Fischer added a comment - http://github.com/cs278/phpbb3/commit/2e7b972ec26c851ebfdc8deb43eeebf4e5ffea36 should have "PHPBB3-9061" instead of "PHPBB-9061".
          Hide
          ToonArmy Chris Smith added a comment -

          Fixed commit message

          Show
          ToonArmy Chris Smith added a comment - Fixed commit message
          Hide
          ToonArmy Chris Smith added a comment -

          Whoops!

          Show
          ToonArmy Chris Smith added a comment - Whoops!

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development