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

Race condition in unique_id() on heavily busy database.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.0.8
    • 3.0.9-RC1
    • None
    • None

    Description

      [22:04:36] <mbox> hello.. i have a suggestion for the unique_id() function, to improve performance on MyISAM. it's this... reverse the order of the two set_config lines so that the timestamp is set in the database before the random seed.
      [22:05:23] <mbox> this stops it from getting out of control when there's high contention on the phpbb_config table
      [22:06:19] <mbox> when it would get 10 seconds behind for any reason, any new unique_id call is generating 2 calls... first, setting the value... then setting the timestamp
      [22:07:58] <mbox> i can't think of how to explain it better, but the result was more and more threads being created and contending for that lock, but they had to get it twice before their timestamp got set. setting it first will greatly reduce the number of threads trying to seed it.
      [22:11:00] <mbox> it was bringing down my database server.
      [22:47:40] <mbox> this poorly made diagram should help explain the race condition i mentioned earlier: http://i.imgur.com/wR3S3.png
      [22:47:46] <mbox> hope it helps someone other than me. enjoy.

      Attachments

        Issue Links

          Activity

            People

              bantu Andreas Fischer [X] (Inactive)
              bantu Andreas Fischer [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: