FLUID-3436: Concurrent identical builds will cause a race condition that results in an error for everyone but the person whose build finishes first.

Metadata

Source
FLUID-3436
Type
Bug
Priority
Blocker
Status
Closed
Resolution
Fixed
Assignee
Laurel Williams
Reporter
Laurel Williams
Created
2009-12-16T15:09:20.000-0500
Updated
2010-01-05T15:49:10.000-0500
Versions
N/A
Fixed Versions
  1. 1.2
Component
  1. Infusion Builder

Description

If more than one identical, uncached build is requested at roughly the same time, an error occurs for all users but the first. This is due to the fact that both processes try to update the cache, inserting a new cache record with the same primary key. Attempts to do this subsequent to the first one will violate the unique constraint for this table in MySQL.

We can fix this by recognizing when a cache insert error occurs and actually checking the cache for the appropriate files, rather than just throwing an error.

Bug Parade Builder 1.1.2

Comments

  • Justin Obara commented 2009-12-18T16:06:05.000-0500

    Bug Parade Builder 1.1.2

  • Laurel Williams commented 2010-01-04T11:03:07.000-0500

    The attached patch FLUID-3436-1.patch.txt should solve the problem. It follows up a failed cache insert with a check that the requested build had already been cached. If the cached item exists then the processing continues as expected. Otherwise a failure is thrown as before.

    I've tested this briefly by bypassing the code which initially checks for caching, but this needs to be applied and tested properly with several concurrent users in the same way we did before.

  • Laurel Williams commented 2010-01-04T14:57:59.000-0500

    I moved the code into a separate function which returns true or false if the file is cached or not cached. The function is longer than the mysql query in the previous patch. The function fails if the mysql query results in an error and then ensures that the successful query returns a row of data. I also changed the names of the variables in the existing code to be a little more descriptive (ie. $is_cached rather than $cached_row).

  • Justin Obara commented 2010-01-04T16:41:42.000-0500

    I walked through the code with Laurel, it looks good. I only recommended changing the name of the $cached_rows variable.

  • Laurel Williams commented 2010-01-05T12:20:04.000-0500

    Made a small change to the variable names in the function as per Justin's suggestion, and fixed a spelling error in the error message.

  • Colin Clark commented 2010-01-05T15:47:22.000-0500

    I've reviewed Laurel's third patch to this issue and it looks good. Committed at r8952.

  • Colin Clark commented 2010-01-05T15:49:10.000-0500

    This one is cool for the 1.1.2.1 release of Builder.