Ghostscript creates huge temporary file

3

3

Our web application converts pdf to png using ghostscript. Recently, a huge, over 60GB, temporary files was created on /tmp directory. Load average raised up to 18 near the time when this file was created. I'm completely lost on this, and would really appreciate any help. Thank you!

Detail:

  • Ghostscript version is 8.70
  • OS is Red Hat Enterprise Linux Server 5.2 (Tikanga)
  • PDF file as input existed on file server. File size is about 150MB, 2 pages, 445.8 x 323.2 mm, PDF 1.6 (Acrobat 7.x)
  • A problem of nfs occurred almost at the same time the file was created.
  • I can't know which is the root cause: file size, file content, or problem of nfs.
  • Content of /tmp when the file was created is:

    ls -lh /tmp
    ...
    -rw------- 1 apache apache 39K Jan 21 17:29 gs_eNsUng
    -rw------- 1 apache apache 66G Jan 29 12:12 gs_GamtbA
    ...
    
  • The application executes command such as:

    gs \
    -dSAFER \-dBATCH \
    -dNOPAUSE \
    -sDEVICE=png48 \
    -dTextAlphaBits=4 \
    -dGraphicsAlphaBits=4 \
    -dMaxStripSize=8192 \
    -dUseCropBox \
    -sOutputFile=[path of output image file] \
    [path of input pdf file]
    

tama-d

Posted 2013-01-31T18:52:57.217

Reputation: 33

Answers

1

First, 8.70 is ANCIENT. Our most recent release (last August) was 9.06 and 9.07 release candidate is out and 9.07 is expected early Feb. (barring complications).

http://www.ghostscript.com/~chrisl/ghostscript-9.07rc1.tgz http://www.ghostscript.com/~chrisl/ghostpdl-9.07rc1.tgz

http://www.ghostscript.com/~chrisl/MD5SUM http://www.ghostscript.com/~chrisl/SHA1SUM

(ChrisL is our release coordinator).

-dMaxStripSize=___ is only used for tiff devices, not png* (but it is not a problem)

Sometimes -dBufferSpace=32000000 (default is 4000000) will reduce the clist size a bit. More likely this was a bug that has been fixed. Please retest with current code.

If this persists with newer code, we (Artifex) would need the file. In that case, please open a bug at http://bugs.ghostscript.com

Ray Johnston

Posted 2013-01-31T18:52:57.217

Reputation:

4

I'm having the same problem using Ghostscript 9.05, and I found the following bug: http://bugs.ghostscript.com/show_bug.cgi?id=693121 which is written for Ghostscript not clearing its temporary files when it terminates abnormally.

Our application converts PDF to JPG and sometimes end-users will throw us PDFs that are not handled well by Ghostscript, so we time the process and kill it if it takes longer than a set time. It sounds like we need to also find and remove the temporary file in this situation until this bug is fixed.

TikiTavi

Posted 2013-01-31T18:52:57.217

Reputation: 141