-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #207: Allow multiple instances of drupal-check to run #208
Conversation
Include the process ID in the temporary configuration filename, so that two instances of drupal-check starting simultaneously do not share the same configuration file.
If two phpstan processes share the same temp directory, it reports "PHPStan crashed in the previous run probably because of excessive memory consumption."
This patch fixed the |
Interesting. This sounds like it should also affect phpstan in general. I'll see how they generate the |
So it doesn't handle it there either: https://github.com/phpstan/phpstan-src/blob/a1c7572a7be6251f2ef2265a97c75a26427f8741/src/Command/CommandHelper.php#L244
We should make sure to create a follow up there. |
Sorry, I'm wrong. I realize this is about the custom configuration generated when running drupal-check and its clean up. Not the caches and such made by PHPStan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is something we should be adding as I'm afraid of consequences. Also, PHPStan doesn't do this when generating its temp directory.
If the problems is Jenkins sharing temp directories, each job is not isolated enough. I would override the PHP ini value that sets the system temp directory.
sys_temp_dir = "/var/tmp"
See https://www.php.net/manual/en/ini.list.php
Maybe we could add an option for specifying the temp directory. Otherwise, I highly recommend just adding phpstan/phpstan
with mglaman/phpstan-drupal
to your project and customizing the config directly there.
], | ||
'tmpDir' => sys_get_temp_dir() . '/phpstan' . '_' . getmypid(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if we should be modifying the tmpDir
where PHPStan puts its caches. If this is having issues in Jenkins on a shared environment, is there a way to customize the system temp directory PHP pulls?
Thanks for having a look at this. I agree that our CI is not isolated enough (and as a workaround we ended up having a cron job to clean the When using phpstan directly (or drupal-check without this patch), this is not a problem because the folder is always |
To say the temp folder uses a lot of space is an understatement. I ran this twice on 2 different D8 and D9 sites and the result was below:
Seriously? Rather than changing the folder name, would it make sense to create subdirectories with the pid instead? Something like |
If you have these problems, use PHPStan directly and customize the tmpDir. I'm not going to rebuild features in PHPStan for this tool. |
An easy workaround is to use the TMPDIR=./foo/ ./vendor/bin/drupal-check |
Fixes #207
Include the PHP process ID in the temporary configuration filename, so that two instances of drupal-check starting simultaneously do not share the same configuration file.