Fix #10505 Rebuild and repair can lead to malformed grouped JS files #10507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #10505
Make other processes (web users) wait to read the grouped JS files until AFTER they're written out to disk.
Description
The function
ConcatenateFiles()
now prevents users from accessing the combined grouped JS files, until after they're added together and saved to disk. How does it accomplish this? It locks for exclusive access each grouped JS file, writes all its contents, then unlocks the file for any user's web browser to download and run.Motivation and Context
There is a race condition on the grouped (combined) JS files, resulting in malformed JS files which fail run.
How To Test This
Test original code: bug:
This test will cause a race condition, as each user's Suite web process will build the grouped JS code files at the same time, and some of the JS code files could be malformed and fail to run, because each Suite is allowed to write to the same grouped JS code file at the same time, resulting in a Frankenstein JS code file that fails to run.
Test fixed code:
Same procedure as above.
After QRR (cleared JS grouped code file cache), no matter how many simultaneous users load the Suite login page, Suite should only build well formed grouped JS code files.
Types of changes
Final checklist