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

prod env cache problem #11

Open
alexbumbacea opened this issue Dec 3, 2016 · 9 comments
Open

prod env cache problem #11

alexbumbacea opened this issue Dec 3, 2016 · 9 comments
Labels

Comments

@alexbumbacea
Copy link

alexbumbacea commented Dec 3, 2016

Hi,

I have a problem in production, it check for write permission on "cache/aspect" folder. And it doesn't have the right... it fails (event if the cache:warmup was already done).
This shouldn't happen as the entire "cache" should be written by "cache:warmup".

Steps to reproduce:

  1. Run as root php ./bin/console cache:clear -e=prod
  2. Run as www-data any other command (make sure you still do -e=prod )
@lisachenko
Copy link
Member

Hi! It's always bad idea to run any symfony command from the root user. You should always use the same user name as for your web server.

Alternatively, you could configure cache file mode and check umask settings to enable creation of directories with write/read rights for everyone (not so good idea, but it's also a solution)

@alexbumbacea
Copy link
Author

Hi
Right about the root vs web server user stuff. :).
If you look at how symfony handles "cache:warmup" in prod env, this should work. All the write work should be done during the warmup.

@lisachenko
Copy link
Member

Could you please try my second advice? To configure the cacheFileMode option for the framework. And enable write for the group and for everyone too.

@alexbumbacea
Copy link
Author

Thanks for the advice. The problem was already resolved on my "prod" environment when I raised the issue.
But I still think that the permission check should not be done in those conditions (as it has nothing to write)

@lisachenko
Copy link
Member

If I remember correctly, for the production mode there is no filemode check. But I need to look this or check... If you seeing the mistake and can fix it by PR, then just send me it, I will merge it after review.

@alexbumbacea
Copy link
Author

goaop/framework/src/Instrument/ClassLoading/CachePathManager.php:85

@lisachenko
Copy link
Member

I'm from the phone. Definitely something is wrong, but cache directory should be present, isn't it? (And in this case we won't try to check if our directory it's writable or not)

@alexbumbacea
Copy link
Author

alexbumbacea commented Dec 3, 2016

I think i copied that from a tag.
if (!$this->kernel->hasFeature(Features::PREBUILT_CACHE) && !is_writable($this->cacheDir))
This is the section i'm referring too.

Should I enable that feature in prod?

@lisachenko
Copy link
Member

Yes, now I can see your case. But I hadn't time right now to fix this...

@lisachenko lisachenko added the Bug label Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants