Repository navigation
Do not delete a container that another process has not journaled yet - #6797
Merged
staabm merged 1 commit intoOct 24, 2026
Merged
Conversation
PHPStan processes that share a tmpDir journal the containers they load, and each one deletes the container files that are not in the journal. A process writes a new container before it journals it, so a concurrent process could delete the file before it was included. The process then failed with "Unable to include ... Container_*.php". A file that is not in the journal is now deleted only when it is more than a week old. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
staabm
approved these changes
Oct 24, 2026
VincentLanglet
approved these changes
Oct 24, 2026
Contributor
|
Thank you! |
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.
The "Integration tests" job fails now and then with
Nette\IOException: Unable to include '.../phpstan/cache/nette.configurator/Container_*.php'. In theTestsruns since 2026-10-06, this happened 8 times: 7 times on Windows inCommandHelperTestandAnalyseCommandTest, and once on Ubuntu. These tests run in parallel and share the default tmpDir,sys_get_temp_dir() . '/phpstan'.Configurator::journal()records the container a process loads, and then deletes every container file that is not in the journal. A process writes a new container before it journals it. A concurrent process can delete that file in this gap, so the first process cannot include it. Users who run several PHPStan processes with different configurations and the same tmpDir hit the same error.A container file that is not in the journal is now deleted only when it is more than a week old. A file that another process has just written is new, so it stays. The journal still removes containers that nobody used in the last week.
ConfiguratorJournalTestsets up a journal and container files of different ages, and checks which filesjournal()keeps. Without the fix, it fails on the new file that is not journaled yet.To reproduce the race, I started six
clear-result-cacheprocesses at once, 20 times. Each process had its own configuration and all of them shared one tmpDir. On 2.3.x, three such runs had 8, 5 and 6 failed starts out of 120, all withUnable to include. With this change, two runs had no failed starts.BaselineNeonErrorFormatterIntegrationTestfailed 4 more times in the same period, withCould not clear result cache.or aJsonException. It uses the same tmpDir, so these failures may have the same cause. I could not confirm this.🤖 Generated with Claude Code