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

Handle errors when restoring from cache #81

Merged
merged 1 commit into from
Sep 17, 2019
Merged

Handle errors when restoring from cache #81

merged 1 commit into from
Sep 17, 2019

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Sep 17, 2019

If the cache file became garbled for some reason, this should not break anything.

Q A
Bug fix? yes
New feature? no
Doc updated no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT

See also #82 where i try to prevent us from writing corrupt caches.

If the cache file became garbled for some reason, this should not break anything.
@goetas
Copy link
Collaborator

goetas commented Sep 17, 2019

Hi! Thanks for the PR. Did this effectively happen?

@dbu
Copy link
Contributor Author

dbu commented Sep 17, 2019

yes, thats what prompted me to do this ;-)

Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "syntax error, unexpected ''C:37:"JMS\\Serializer\\Metada' (T_ENCAPSED_AND_WHITESPACE)" at /home/vcap/app/var/cache/prod/jms_serializer/Namespace-Class.cache.php. one of our nodes ended up having this, and because this cache is not created at cache warmup but only on demand, the deployment process did not notice.

a few days ago, we had the other one with Uncaught PHP Exception LogicException: "The cache must return instances of ClassMetadata, but got 1." at /home/vcap/app/vendor/jms/metadata/src/Metadata/MetadataFactory.php line 73 . i don't know how it managed to end up with a file that did not return anything, and the cache file is now gone... but its what happens when using include.

i assume that there have been problems with the filesystem or network at the time (we have to cope with rather unreliable infrastructure).

i am now doing another PR to have the FileCache validate it actually writes the file correctly too.

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

Successfully merging this pull request may close these issues.

2 participants