Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
LoadFromFile crashes on resources too big for memory #1386
Here's a large (251MB) PDF: http://www.jefftk.com/mike-mulligan-obsolete-internal.pdf?PageSpeed=off
With PageSpeed on, it doesn't load: http://www.jefftk.com/mike-mulligan-obsolete-internal.pdf
This is with LoadFromFile on an ngx_pagespeed system without much memory.
Possibly we're blindly trying to allocate enough memory for it, without checking its size? Yes, I think that's it: neither
It's also surprising that we'd be doing this for a PDF, since we can't optimize that and we know that immediately from the extension. Looking at
Definitely we should be statting files and comparing size against some max value before allocating anything. I think we should be comparing against the max cacheable size, and not an image-specific size.
Since we do cache extend PDFs I think it does make sense for them to work with LoadFromFile. But I don't think it makes sense to do that in the IPRO flow, only the extend_cache filter. We might need to plumb through some context to FileInputResource to make that judgement call, and just skip file-loading .pdfs from IPRO.
We have a
I'm thinking we should switch that default from unlimited to something high but not crazy, like 32MB, and then use it in LFF?