Skip to content
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

Use absolute path to generate and check / cache #32599

Closed
jbdelhommeau opened this issue Jul 18, 2019 · 7 comments
Closed

Use absolute path to generate and check / cache #32599

jbdelhommeau opened this issue Jul 18, 2019 · 7 comments

Comments

@jbdelhommeau
Copy link
Contributor

jbdelhommeau commented Jul 18, 2019

Symfony version(s) affected: 3.4

Description

My issue is a complement to this PR : #32579

When one uses Docker in development mode with a different mounting point between CLI & FPM or local & docker in
the cache keeps regenerating because the all ressource Symfony\Component\Config\Resource\FileResource, Symfony\Component\Config\Resource\GlobResource, Symfony\Component\Config\Resource\FileExistenceResource, Symfony\Component\Config\Resource\DirectoryResource (and maybe others) class see a
different path for each SAPI. For example /home/app/app/vendor vs
/var/www/app/vendor.

So if you hit FPM, then the CLI, then FPM, each time a new cache is
generated. So the application is quite slow in dev env. And for people
on MacOSX (with docker) is a big pain! And obvisouly, this never
stabilizes !

How to reproduce

Clear cache localy and show your app via docker (FPM, or CLI). First time is very very slow because cache will be re generated;

Possible Solution
Referenced resources with the absolute path. But for that you have to inject PROJECT_DIR in the right place.

I'm ready to PR this fix. Can you help me ?

@nicolas-grekas
Copy link
Member

inject PROJECT_DIR in the right place.

that's a good start, PR welcome :)

@jbdelhommeau
Copy link
Contributor Author

Yes indeed,

Do you think it is necessary to modify the resource upstream before creating new FileRessource() or within this class?

How to inject this parameter when you have a lot of new FileResource(). Create a factory of FileResource and use DI ?

@nicolas-grekas
Copy link
Member

I think patching ContainerBuilder::fileExists() is enough (about the factory)

@jbdelhommeau
Copy link
Contributor Author

jbdelhommeau commented Aug 1, 2019

I try to play with it but unfortunately update ContainerBuilder::fileExists() change anything.
In fact each other called class GlobResource, FileResource and DirectoryResource is called out of ContainerBuilder::fileExists() :(

@javiereguiluz javiereguiluz added this to the 3.4 milestone Sep 27, 2019
@fabpot fabpot modified the milestones: 3.4, 4.4 Oct 28, 2020
@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants