[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#810080: marked as done (ghostscript: Infinite loop filling server logs with "File has unbalanced q/Q operators")



Your message dated Mon, 08 Jan 2024 09:17:23 -0600
with message-id <3299999.VqM8IeB0Os@riemann>
and subject line Re: Ghostscript: File has unbalanced q/Q operators (too many Q's)
has caused the Debian Bug report #790562,
regarding ghostscript: Infinite loop filling server logs with "File has unbalanced q/Q operators"
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
790562: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790562
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: ghostscript
Version: 9.06~dfsg-2+deb8u1
Severity: important

Dear Maintainer,

Short version:

* What led up to the situation?

"gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress programmheft_2016.pdf" with http://www.naturpark-rheinland.de/programmheft_2016.pdf leads to infinite output of "**** File has unbalanced q/Q operators (too many Q's) ****" to stderr

* What exactly did you do (or not do) that was effective (or ineffective)?

A) Compiled upstream ghostscript 9.06 and executed the command above
B) Use the upstream ghostscript Resources directory instead of /usr/share/ghostscript/Resources

* What was the outcome of this action?

A) Worked without problems
B) Leads at least to an unrecoverable error instead

* What outcome did you expect instead?

Debians ghostscript package to work as upstream correctly rendering the PDF.


Long version:

One of our Debian wheezy webservers (ghostscript "9.05~dfsg-6.3+deb7u2") was brought down yesterday morning by running out of diskspace very quickly due to a spammed /var/log/apache2/error.log with 700GB of lines with 

"**** File has unbalanced q/Q operators (too many Q's) ****". 

It turned out this was due to a process trying to create a thumbnail image of a pdf file

"gs -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=pnmraw -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r72x72 -dFirstPage=1 -dLastPage=1 -sOutputFile=XXX -- YYY -c quit"

The issue is reproducible on a Debian jessie server (ghostscript "9.06~dfsg-2+deb8u1") too by simply executing 

"gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress programmheft_2016.pdf"

The file is available for download at http://www.naturpark-rheinland.de/programmheft_2016.pdf 

All pdf viewers I tried had no problems displaying the file.

I asked for help at #ghostscript, you can find the log here: http://ghostscript.com/irclogs/2016/01/05.html

I compiled both gs905 and gs906 from ghostscripts git sources and could execute

"./gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress programmheft_2016.pdf"

without errors.

Using the Resource folder of upstream ghostscript for the debian ghostscript package by executing

"gs -I../Resource/Init -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress programmheft_2016.pdf"

leads to 

Error: /rangecheck in --run--
Operand stack:
   --dict:12/21(L)--   1   11   3   --nostringval--   false   76666   DataSource   --nostringval--   0   16   --nostringval--   12   --dict:2/2(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1168/1684(ro)(G)--   --dict:1/20(G)--   --dict:83/200(L)--   --dict:83/200(L)--   --dict:109/127(ro)(G)--   --dict:293/300(ro)(G)--   --dict:25/31(L)--   --dict:6/8(L)--   --dict:25/40(L)--   --dict:1/1(ro)(G)--   --dict:14/15(L)--   --dict:1/1(ro)(G)--   --dict:4/5(L)--   --dict:1/1(ro)(G)--   --dict:7/15(L)--   --dict:9/20(L)--
Current allocation mode is local
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

which is an unrecoverable error but at least no infinite spamming of the error log.

As a workaround I use this on our servers now:

git clone --single-branch --branch gs906 "http://git.ghostscript.com/ghostpdl.git"; ~/ghostpdl
mkdir /usr/local/share/ghostscript/
mv ~/ghostpdl/gs/Resource /usr/local/share/ghostscript/
rm -rf ~/ghostpdl
echo "GS_LIB=/usr/local/share/ghostscript/Resource/Init" >> /etc/environment

Since the problem does not exist on upstream ghostscript 9.05 or 9.06 but only in the debian package it must be due to differences between these too. This are the differences in Resource/Init/* http://pastebin.com/emSHcUFE

-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ghostscript depends on:
ii  debconf [debconf-2.0]  1.5.56
ii  gsfonts                1:8.11+urwcyr1.0.7~pre44-4.2
ii  libc6                  2.19-18+deb8u1
ii  libgs9                 9.06~dfsg-2+deb8u1

ghostscript recommends no packages.

Versions of packages ghostscript suggests:
pn  ghostscript-x  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
I meant to close the bug with the previous email.

On Sunday, January 7, 2024 10:51:59 P.M. CST you wrote:
> On Tue, 30 Jun 2015 09:17:06 +0100 support@compress-pdf.co.uk wrote:
> > package: ghostscript
> > version: 9.06~dfsg-2
> > 
> > When running ghostscript, the following errors are being generated in
> > great quantity:
> > stderr: "   **** File has unbalanced q/Q operators (too many Q's) ****"
> > 
> > resulting in log files filling the disk.
> > 
> > Additionally, kernel soft lockup warnings appear:
> > kernel:[406101.560749] BUG: soft lockup - CPU#4 stuck for 31s! [gs:21647]
> > 
> > 
> > Command being run is:
> > 
> > gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen
> > -dNOPAUSE -dQUIET -dBandBufferSpace=500000000 -dBandSpace=1000000000
> > -dBATCH -sOutputFile='out.pdf' 'in.pdf'
> > 
> > 
> > It may be related to this bug on the ghostscript bug tracker flagged as
> > resolved:
> > http://bugs.ghostscript.com/show_bug.cgi?id=694310
> 
> In the absence of an example file, I will assume you are correct that this
> is the upstream bug noted.  That fix is now in Debian, so I'll close this
> bug. -Steve

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---

Reply to: