Repository navigation
[13.x] Make the parallel compiled view callbacks tolerate a concurrent run - #61786
Merged
taylorotwell merged 2 commits intoSep 29, 2026
Merged
Conversation
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.
Fixes #61785.
TestViewsgives each parallel worker a compiled view directory named afterParallelTesting::token(), the worker index. Two parallel runs of the same project at the same time therefore use the same directories, and both process callbacks that manage them fail when the other run acts between their check and their action:File::ensureDirectoryExists()checksisDirectory()and then callsmkdir()without suppression, so the run that loses fails withmkdir(): File exists.File::deleteDirectory()checksisDirectory()and then constructs aFilesystemIterator, which throwsUnexpectedValueExceptionwhen the directory is already gone.This changes only those two callbacks:
makeDirectory(..., force: true), which does not fail when the directory already exists.It does not change what
token()returns or where the compiled views go, so a single parallel run behaves exactly as before.Tests
Two tests are added to
TestViewsTest. Each replaces thefilesbinding with aFilesystemwhoseisDirectory()answers as it would have just before the other run acted, while the real directory is in the other run's state. The race therefore happens every time, not by chance:isDirectory()says it does not. Set-up must not raise a warning.isDirectory()says it exists. Tear-down must not throw.Against the current
13.ximplementation, both tests fail: the first withErrorException: mkdir(): File exists, and the second withUnexpectedValueExceptionfromFilesystemIterator. With this change they pass, andtests/Testingpasses (414 tests). Run on PHP 8.4, Windows 11.