Server: Preview generator fails on big jpg files

Created on 7 Feb 2017  路  8Comments  路  Source: nextcloud/server

I've posted that issue in the previewgenerator repo already https://github.com/rullzer/previewgenerator/issues/25 and according to that it is a server issue.

Well, if the previewgenerator app just request previews of the system and a jpg file is too big, the app will stuck everytime on that file and can not continue to the next file.

Here is an example of a "big" jpg file: https://upload.wikimedia.org/wikipedia/commons/2/25/Brequin_3_Laxenburg.jpg

bug previews and thumbnails needs info

All 8 comments

Any message in your log file?
I assume it runs out of memory?

No messages in log files, neither nextcloud.log nor apache log.

Assuming that PHP is running out of memory, this actually tires in to a larger issue of how we help protect against limited memory scenarios.

My server actually has a few GB of RAM, and yet even there I had problems with doing initial syncs on new machines for the same reason (it turns out php.ini was limiting ram usage to something like 256mb). Many people are trying to run Nextcloud on far more limited hardware like rPi's etc, so this seems like a pretty common issue. We should be able to check php's ram limit, although I'm not sure if we have any real easy of polling available ram and/or usage.

Well if the image doesn't fit into the allowed memory there is no way around.
We simply can not create a preview then using php.

Well if the image doesn't fit into the allowed memory there is no way around.

Well, i can understand. But then please don't let the app crash, rather let it skip the file in question otherwise the app is becoming unusable because unfortunately there is no way to find out which files is too big and causes the crash.

I've found another interesting issue:

This JPG https://upload.wikimedia.org/wikipedia/commons/d/d6/Valerie_Cottage_Hetzendorf_1885_MGI.jpg is not so big as the above one ("only" 11.555 脳 14.350 Pixel) but it will cause the preview app to crash, just with a "Killed" message on the shell and neither error message in nextcloud.log nor apache log. Also the filename is not displayed, so on a running cronjob it's impossible to find out why the app dies.

But interestingly, if the that image is opened by the gallery app, the preview picture is created correctly and after that the preview app runs without any errors.

So, if the preview app is just requesting the preview picture of the server, why does it crash in case of the preview picture is not generated before by the gallery app?

I don't understand that behavior.

So the gallery app hacked around it. This is now fixed.

I do not get why the app crashes for you as https://github.com/nextcloud/server/blob/master/lib/private/Preview/Image.php#L42-L47 make sure that (by default) no previews are generated for files larger than 50mb. So it should just ignore those files.

Please try again with version 12. It should be handled a bit more graceful there. If this is still an issue, please reopen this one here. Thanks

Was this page helpful?
0 / 5 - 0 ratings