Page MenuHomePhabricator

"Error generating thumbnail" for a specific PDF file (gs OOM'ing?)
Closed, ResolvedPublic


The following link gives an error instead of a thumbnail:Етнографічний_збірник_Т.28.pdf/page1-7625px-Етнографічний_збірник_Т.28.pdf.jpg

The error message is:

Error creating thumbnail: /bin/bash: line 1: 6515 Done 'gs' -sDEVICE=jpeg -sOutputFile=- -dFirstPage=1 -dLastPage=1 -r150 -dBATCH -dNOPAUSE -q '/tmp/localcopy_e0efc8af0d37-1.pdf'
6516 Killed | 'convert' -depth 8 -resize 7625 - '/tmp/transform_6808bfed72ec-1.jpg'

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:18 AM
bzimport set Reference to bz59668.
bzimport added a subscriber: Unknown Object (MLST).
DixonD created this task.Jan 5 2014, 10:07 AM

This can also be a problem in or with the PdfHandler extensions.

Bryan.TongMinh wrote:

My guess would be out-of-memory. Is ImageMagick able to to its memory efficient jpeg resizing algorithm when reading from stdin?

Id guess gs being the thing oom.

The problem is, that the PDF is probably not correct and the GhosScript puts out some messages

wget "" --output-document="testfile.pdf"
# process by gs
gs -sDEVICE=jpeg -sOutputFile=testfile.jpg -dFirstPage=1 -dLastPage=1 -r150 -dBATCH -dNOPAUSE -q 'testfile.pdf'
 **** Warning: glyf overlaps cmap, truncating.
 **** Warning: glyf overlaps cmap, truncating.
 **** Warning: glyf overlaps cmap, truncating.
 **** Warning: glyf overlaps cmap, truncating.
 **** Warning: glyf overlaps cmap, truncating.

ImageMagick consumes these (via | pipe) and consequently ImageMagick fails to process the image, because the text-warning messages are rerouted to ImageMagick. The warning messages are printed to stdout.

I have the same issue

The solution would be a feature request:

  1. gs should write an intermediary image file
  2. convert uses this intermediary image file instead of pipe input

See also

Gilles added a subscriber: Gilles.Jan 19 2015, 2:00 PM

I can't reproduce the warnings on a stock mediawiki vagrant VM, sadly, but avoiding the pipe sounds like a sensible thing to do anyway.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:38 PM
Restricted Application added subscribers: Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:38 PM
Restricted Application added a subscriber: Base. · View Herald TranscriptJan 27 2017, 10:11 PM

I have even tried in my localhost and run perfectly there is no error displaying I think previously this was due to "-dSAFER" actually a bug in ghostscript it can be checked here , If anyone reproduces please specify?

Aklapper closed this task as Resolved.Nov 16 2017, 1:10 AM

The test case provided in this task summary renders correctly for me.
Hence closing this task as this problem cannot be reproduced anymore nowadays.
Please reopen and provide links if you can still reproduce this very problem. Thanks!