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

Cached size is not updated #7

Closed
kelunik opened this issue Apr 11, 2018 · 3 comments
Closed

Cached size is not updated #7

kelunik opened this issue Apr 11, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@kelunik
Copy link
Member

kelunik commented Apr 11, 2018

The cached size of files is not updated. If files are changed, this might result in a wrong content-length header.

@kelunik kelunik added the bug Something isn't working label Apr 11, 2018
@minbaby
Copy link

minbaby commented May 25, 2018

I think this bug is because of amphp/file.

StatCache cache the file state, but not update file state when file info changed.

$fileInfo->etag = \md5("{$fileInfo->path}{$fileInfo->mtime}{$fileInfo->size}{$inode}");

if (!$stat = yield $this->filesystem->stat($path)) {

https://github.com/amphp/file/blob/cc1d11993e1546e4cad9bd2de22c6ba8ff88af3c/lib/UvDriver.php#L115

https://github.com/amphp/file/blob/cc1d11993e1546e4cad9bd2de22c6ba8ff88af3c/lib/StatCache.php#L19

@bwoebi
Copy link
Member

bwoebi commented May 25, 2018

So, setting StatCache::ttl(0); in your server does fix it?

Generally the StatCache is a good thing, reducing latency by a good margin...
We possibly should add a file change watcher (i/anotify for example) for stat invalidation ...

@minbaby
Copy link

minbaby commented May 25, 2018

Yeah, we need inotify extension. if has inotify, all the thing can bu resolved.

This is two reason,first is StatCache, another is cache too.
We can't get the file stat on file changed. if We have not inodify,only update file info in every seconds

private function fetchCachedStat(string $reqPath, Request $request) {

kelunik added a commit that referenced this issue Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants