[5.8] Replace contents of service manifest atomically#28973
Merged
taylorotwell merged 1 commit intolaravel:5.8from Jun 27, 2019
Merged
[5.8] Replace contents of service manifest atomically#28973taylorotwell merged 1 commit intolaravel:5.8from
taylorotwell merged 1 commit intolaravel:5.8from
Conversation
11b0ef4 to
563e7d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It is possible for concurrent requests to try and write the services manifest (
bootstrap/cache/services.php) at the same time. This can occur whenever the file is not present (e.g. afterphp artisan clear-compiled) or when the set of providers changes (after code changes).Each request will first read the manifest file or detect its absence, take some time to generate the contents of a new manifest, and lastly try to write the manifest. This write action will be done without obtaining a file lock first.
framework/src/Illuminate/Foundation/ProviderRepository.php
Lines 193 to 195 in 15b4e49
We have encountered broken service manifest files in our installations multiple times in the last few days. Once it breaks, both HTTP requests and Artisan requests will fail. Manual deletion of the file is needed.
Example of broken file:
This pull request will alter the behavior of writing the manifest file so it uses atomic actions. Concurrent writing will no longer occur.
Please note that this bug has been around since version 5.2.0