PDFPreview was operating well, until I blithely submitted an 80-page 4.6M PDF whose first page featured a large gradient image. Much time passed. Some research uncovered the obvious, that the ImageMagick process was swamping a CPU. I decided to later add a lighter first page to the PDF, then manually killed the process and went to bed. The next morning I found about a dozen of the same processes running on the server, swamping all the CPU cores. Restarted Apache to kill them. Moreover, cron had become stuck for whatever reason, so I deleted cron_last and cleared the cache. Then this error appeared in the logs:

User error: ImageMagick error 9: **** ERROR: Unable to process JPXDecode data. Page will be missing data. in _imagemagick_convert_exec() (line 481 of /home/xxxx/public_html/sites/all/modules/imagemagick/imagemagick.module).

Phew. So now I know to avoid submitting large PDF's. My request is PDFPreview offer some kind of graceful handling of these edge cases. Perhaps giving content creators a manual override to NOT have a thumbnail created upon upload, or some kind of timeout.

Maybe there is a kludge (temporarily reducing image quality to 5%? Temporarily disabling the module?).

I'm submitting this as a feature request, though perhaps the respawning of an uncompleted process might be called a bug.

Comments

trevorbradley’s picture

I Have this same problem on 6.x - it's brutally nasty - taking down the server while I sleep and having angry clients in the morning. It would be great if convert could be called with some sort of timeout.

It's not just large pdfs. I put in a restriction to avoid converting PDFs larger than 5MB, but some of the 3MB PDFs I have also stall completely on conversion.

mhkc’s picture

I'm having a similar problem, but in my case the files are less than 2MB in size. Sometimes it is a simple single file, sometimes it's a PDF portfolio. In some cases the image is created, in others it is not, doesn't seem to be related to whether it's a portfolio or just a basic pdf. In any case, it would be nice to have the ability to define a 'default' image that could be used in the event that one doesn't get generated for whatever reason, or to be able to override the creation of the image as needed.

berdir’s picture

Issue summary: View changes

In case someone else runs into this. The problem is most likely not that the convert process itself is stuck, but that stderr is full because there are too many errors/warnings displayed.

See #2842555: ImageMagick module hangs file upload process when convert of PDF file results in more than 64K chars of warnings.