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

Ability to disable tmp caching of phar contents #13055

Open
dktapps opened this issue Dec 30, 2023 · 5 comments
Open

Ability to disable tmp caching of phar contents #13055

dktapps opened this issue Dec 30, 2023 · 5 comments

Comments

@dktapps
Copy link
Contributor

dktapps commented Dec 30, 2023

Description

It's not clear to me what the point of caching phar contents is. In a world where opcache is used, it shouldn't be necessary to cache the phar contents anyway, except perhaps the occasional data file.

In addition, since different threads / processes don't share phar caches, /tmp can get very crowded with lots of files caching near-identical data.

I maintain a long-running application in which autoload time is not a concern, but the hogging of tmp space is a problem for my users. There doesn't seem to be a way to stop ext-phar from caching things read from phars.

@dktapps
Copy link
Contributor Author

dktapps commented Dec 30, 2023

Additionally the cache files don't seem to go away when unseting the phar, which seems weird and also prevented me from solving this with a custom stream wrapper.

@crrodriguez
Copy link
Contributor

crrodriguez commented Dec 30, 2023

in a modern OS it should be enough to remove this caching but set POSIX_FADV_WILLNEED though this all probably only matters (if at all) at all with slow storage..
Note that nowadays /tmp is backed by virtual memory..

@dktapps
Copy link
Contributor Author

dktapps commented Jan 9, 2024

in a modern OS it should be enough to remove this caching but set POSIX_FADV_WILLNEED though this all probably only matters (if at all) at all with slow storage..

Only files that were compressed in the phar are cached on /tmp, so I don't think the storage speed is the concern. Uncompressed files are read directly from the .phar.

@dktapps
Copy link
Contributor Author

dktapps commented Feb 19, 2024

Seems like the awkward design of the stream wrapper ops makes the tmpfile a necessity for handling compressed files within phars. Too bad PharFileInfo doesn't have any way to get the offset within the .phar file or I could probably solve this with gzopen() in PHP ...

@crrodriguez
Copy link
Contributor

It isn't awkward..it is just old .. a proper generic decompression library like libarchive wasn't an option back then. Today it could be just a libarchive filter/format and PHP just evaluates the code..

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

3 participants