-
Notifications
You must be signed in to change notification settings - Fork 651
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
Cache doesn't work when the composer.lock is in a sub directory. #4941
Comments
Hey @VincentLanglet, can you reproduce the issue on https://psalm.dev ? |
I tried another cacheDirectory, and I takes 90s now. Maybe it was because the cache directory was previously in the shared folders of my vagrant. But I don't understand why running psalm with or without the cache takes the same time. What's the interest of the cache then ? |
This is generally not the case. Maybe there's something on your codebase that makes psalm write too much in cache to a point where reading the cache is detrimental? On my work codebase, Psalm will run out of memory(12Go) just trying to write the cache, not to talk about reading it. Maybe a blackfire profile could tell us more if you want to investigate EDIT: you could also try to simplify your config file to see if you can replicate without exotic config. Try only analyzing src/ without plugins and without your custome autoloader |
With this config:
Running psalm give this output:
If I run it again, it takes the same time. Without cache:
With phpstan the cache is working fine, so I don't know what would cause an issue in my codebase. |
what happens if you run it a third time? |
First run
Second run
Third run
Fourth run
So it seems to be more impactful after two runs indeed. Why ? But still, with
So I have no benefit. |
When cache is in effect you should get no progress bar and Mind running with |
It never happen ! So cache is not working (but still using more memory than no-cache).
I got
Which I found weird ; so I looked at the vendor. The
I think it's because the
And now cache is working. When running composer, we're using I can try to add a such option if you want, but I will need some help |
oh nice catch! I wonder if Composer provide a way to find the lock file automatically |
@VincentLanglet Do you also have to specify composer autoloader manually in |
Unlikely, there wouldn't be a need to specify it as CLI argument if that was the case. |
The psalm code use
here: https://github.com/vimeo/psalm/blob/master/src/Psalm/Internal/Composer.php#L24 So I thought that
could work but the line
is removing the I tried to comment it temporary and then I get
I use
because I'm using the symfony phpunit bridge. But I tried without and I don't need to specify the autoloader file to run psalm. (phpunit will just not be found) |
Interesting. Can you trace how Psalm is finding your |
Continuing the debugging: This is a dump of the
With the first path,
If you look at https://github.com/composer/composer/blob/5df1797d20c6ab1eb606dc0f0d76a16ba57ddb7f/src/Composer/Factory.php#L233 Composer is not using I just tried and composer does support a path like But then there is still something to do, because with this line commented and
And I get an error.
So the working command is (with the comment of
I think that
should be enough. So it required to fix the I looked at 1. My issueIt seems like my issue is here: Line 469 in b6a3282
The But it's weird because, if I look at the doc
2. The php version
In my case, if I run 3. The plugin listAnother weird thing is that Line 21 in da632ca
By the way, I found another issue during my tests: #4952 |
Thanks for the detailed write up. Mind sharing your project directory structure? This would help to reproduce it locally. |
The project directory is
I run |
Do you also check files outside |
No
Yeah sure, it was just easier to have the config in the root dir. And the current behavior is misleading.
Currently, the psalm file is
Maybe it should be done in the opposite way
This way, the |
We are facing the same issue, that the cache is not used, but we have slightly different project setting
We have two different templates. one for developing "project" and one for running "project" production. These two templates have basically just one requirement which is
In the production template this normally required and located in vendor. So in our dev template, we are using psalm, which is installed within the The missing I'm also pretty sure, that the cache worked properly in some 3.x release before. I hope this helps to find a solution 😊 //Edit: Just tested 3.9.0. With this, the caching works as expected. Same with 3.15.0 |
When I run
I get the output:
If I run again the command, the output is
I tried
--no-cache
, I got the outputI also tried,
--no-diff
, I got the outputThis is my psalm config
The text was updated successfully, but these errors were encountered: