Fix race condition creating parser cache directory (fixes #4483)#5603
Fix race condition creating parser cache directory (fixes #4483)#5603muglug merged 1 commit intovimeo:masterfrom
Conversation
I wasn't able to reproduce the error under normal conditions, but I set a breakpoint on the `mkdir` call, created the directory, then continued, and it seems to handle it correctly.
|
|
||
| private function createCacheDirectory(string $parser_cache_directory): void | ||
| { | ||
| if (!is_dir($parser_cache_directory)) { |
There was a problem hiding this comment.
wouldn't @mkdir(...) make more sense? After all, we only want the directory to exist. On the other hand this could just move race-condition elsewhere.
There was a problem hiding this comment.
Technically it could be a file for some reason, in which case an error should be thrown, but I wouldn't really be opposed to changing it to @mkdir(...), as it being a file seems incredibly unlikely.
I suppose you're right that this could just move the race condition somewhere else, I hadn't considered that. I haven't really looked into how the caching works, hopefully different processes aren't going to be using the same $file_cache_key.
There was a problem hiding this comment.
mkdir could also fail due to lack of write permission, which also seems unlikely, but more likely than the directory path being a file.
|
Thanks! |
I wasn't able to reproduce the error under normal conditions, but I set a breakpoint on the
mkdircall, created the directory, then continued, and it seems to handle it correctly.