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

Loris failing with no error when width is set to 500, but not at 499 or 501 or any other dimension #475

Open
jeffreycwitt opened this issue Sep 11, 2019 · 7 comments

Comments

@jeffreycwitt
Copy link

Can someone help me with this weird problem.

Loris failing with no error when width is set to 500, but not at 499 or 501 or any other dimension

So for example:
This does NOT work: https://loris2.scta.info/hopkinsMSB19/Lombard_Manuscript-197.jpg/full/500,/0/default.jpg. Loris returns a blank page, without an error

Works: https://loris2.scta.info/hopkinsMSB19/Lombard_Manuscript-197.jpg/full/501,/0/default.jpg
Works: https://loris2.scta.info/hopkinsMSB19/Lombard_Manuscript-197.jpg/full/499,/0/default.jpg

Any advice is much appreciated.

@bcail
Copy link
Contributor

bcail commented Sep 11, 2019

@jeffreycwitt is there anything in the log? What's the HTTP status code on the failing response?

@alexwlchan
Copy link
Contributor

HTTP status code seems to be 500.

I’ve just tried in a local instance, using Lombard_Manuscript-197.jpg at full size as the original image; it works fine for me.

If I truncate the cache entry (e.g. echo '' > /cache/entry/default.jpg), I get a 500 error – I wonder if a cache has been corrupted somewhere, and Loris isn't handling that correctly?

@jeffreycwitt
Copy link
Author

jeffreycwitt commented Sep 11, 2019 via email

@alexwlchan
Copy link
Contributor

@jeffreycwitt I believe it’s whatever path you have set in img.ImageCache.cache_dp in your config file, e.g. if your config was

[img.ImageCache]
cache_dp = '/usr/local/share/loris/image_cache'

the cache directory would be /usr/local/share/loris/image_cache.

I don't know how to find this specific image in the cache off the top of my head; I'm about to get on a train so can't test right now!

@alexwlchan
Copy link
Contributor

I’m on holiday next week so I can’t work on this then, but here are my ideas:

We add a method to ImageCache that deletes a cache entry. If we process a request and get a "not an image" error thrown from the cache, we delete the cache entry and throw the 500 error. When the user reloads, the cache gets repopulated and they get the image they want.

We could also retry the request (using something like https://pypi.org/project/tenacity/), but we want to be careful not to get stuck in an infinite retrying loop, e.g. if the source file is garbage.

@jpstroop
Copy link
Member

jpstroop commented Sep 21, 2019 via email

@bcail
Copy link
Contributor

bcail commented Sep 23, 2019

@alexwlchan that sounds great to automatically purge an image from the cache if we know it's corrupt.

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

No branches or pull requests

4 participants