Bug#343901: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files
forwarded 343901 http://bugs.ghostscript.com/show_bug.cgi?id=691820 quit Sebastian Schmidt wrote: > gs-esp with -sDEVICE=lx5000 hangs when printing PostScript files > generated by mozilla (firefox, in this case). Based on a belief that there are no coincidences, I'm linking this to a seemingly related upstream report. Further discussion should probably happen there. Thanks again for your help. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#343901: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files
Hi again, Just an update (no patch yet). Thanks for the advice. $ git clone git://git.ghostscript.com/ghostscript.git $ cd ghostscript/gs $ git apply debug-lx5000.patch $ autoreconf -fis $ ./configure $ make | $ bin/gs -dSAFER -sDEVICE=lx5000 -sOutputFile=/dev/null /tmp/mozilla.ps | GPL Ghostscript SVN PRE-RELEASE 9.01 (2010-09-14) | Copyright (C) 2010 Artifex Software, Inc. All rights reserved. | This software comes with NO WARRANTY: see the file PUBLIC for details. | Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu... 2592440 1272826 8750092 7452670 1 done [...] | Loading StandardSymL font from %rom%Resource/Font/StandardSymL... 3878968 2514682 8850572 7498285 1 done. | trace: refresh buffer, 4 colors. | trace: color 0, pen 0: line 6663 | trace: color 1, pen 0: line 6663 | trace: color 2, pen 0: line 6663 | trace: color 3, pen 0: line 6663 | trace: first printable line: 6663 | trace: next line to get: 0 | trace: color 0: line 32 | trace: done getting lines. next line to get: 288 A good start. | trace: refresh buffer, 4 colors. | trace: color 0, pen 0: line 32 | trace: color 1, pen 0: line 6663 | trace: color 2, pen 0: line 32 | trace: color 3, pen 0: line 32 | trace: first printable line: 32 | trace: next line to get: 288 | trace: done getting lines. next line to get: 288 First line after margin: 32. Three colors to print. [...] Some boring parts. ;-) [...] | trace: refresh buffer, 4 colors. | trace: color 0, pen 0: line 6517 | trace: color 1, pen 0: line 6663 | trace: color 2, pen 0: line 6663 | trace: color 3, pen 0: line 6517 | trace: first printable line: 6517 | trace: next line to get: 6773 | trace: done getting lines. next line to get: 6773 6773 > 6663. > trace: refresh buffer, 4 colors. > trace: color 0, pen 0: line 6517 > trace: color 1, pen 0: line 6663 > trace: color 2, pen 0: line 6663 > trace: color 3, pen 0: line 6551 > trace: first printable line: 6517 > trace: next line to get: 6773 > trace: done getting lines. next line to get: 6773 And we loop on this state. The next line to _print_ is 6517 (presumably less than pdev->height) but the next line to get is greater than that. The driver writes empty swipes for some reason and hangs. Jonathan Date: Sat, 22 Jan 2011 15:34:13 -0600 Subject: lx5000: add some debugging printfs --- gs/contrib/gdevlx50.c | 65 - 1 files changed, 48 insertions(+), 17 deletions(-) diff --git a/gs/contrib/gdevlx50.c b/gs/contrib/gdevlx50.c index 9d6b7da..154d780 100644 --- a/gs/contrib/gdevlx50.c +++ b/gs/contrib/gdevlx50.c @@ -228,11 +228,23 @@ * I N C L U D E F I L E S * / #include "std.h" +#include #include #include "gdevprn.h" #include "gsparam.h" #include "gsmalloc.h" +#undef stderr +static void trace_printf(const char *fmt, ...) +{ + va_list params; + + va_start(params, fmt); + vfprintf(stderr, fmt, params); + va_end(params); +} +#define stderr gs_stderr + / * R C S I D E N T S T R I N G S * / @@ -1367,17 +1379,26 @@ refreshBuffer( lx5000_device *lx5000dev, int_1stPrintable; /* Across all pens */ intnumColours = lx5000dev->color_info.num_components; +trace_printf("trace: refresh buffer, %d colors.\n", numColours); + /* Establish the next line to print, if it is already in the buffer.*/ _1stPrintable = pens[YELLOW_X][LO_PEN].finalLine; for ( colour = 0; colour < numColours; colour++ ) { for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ ) - if ( pens[ colour ][ pen ].nextPrintLine < _1stPrintable) - _1stPrintable = pens[ colour ][ pen ].nextPrintLine; + { + int line = pens[ colour ][ pen ].nextPrintLine; + trace_printf("trace: color %d, pen %d: line %d\n", +colour, pen, line); + if ( line < _1stPrintable) + _1stPrintable = line; + } } +trace_printf("trace: first printable line: %d\n", _1stPrintable); *nextLineToPrint = _1stPrintable; +trace_printf("trace: next line to get: %d\n", *nextLineToGet); nextToGet = (uchar)(*nextLineToGet & COLOUR_BUF_MASK); /* nextLineToPrint may be set high (i.e. not known), or may be a known print line. */ @@ -1429,6 +1450,9 @@ refreshBuffer( lx5000_device *lx5000dev, the lower pen. */ if ( ! lineEmpty[colour][nextToGet] ) { + if ( *nextLineToPrint > *nextLineToGet ) +
Bug#343901: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files
Hi Peter, I was trying to debug an old hang with ghostscript's lx5000 driver and am stuck. [1] has the original report and test file. Sebastian Schmidt wrote: > gs produced 94MB output after 10 seconds or so, but what's notable about > it is the following (hexdump -C): > 05d13f70 00 02 02 00 18 00 ec 19 13 e8 00 00 00 00 2b 70 |..ì..è+p| > 05d13f80 62 77 01 1b 2a 03 00 00 1b 2a 04 00 00 00 1a 00 |bw..**..| > 05d13f90 02 02 00 18 00 ec 19 13 e8 00 00 00 00 2b 70 62 |.ì..è+pb| > 05d13fa0 77 01 1b 2a 03 00 00 1b 2a 04 00 00 00 1a 00 02 |w..**...| > 05d13fb0 02 00 18 00 ec 19 13 e8 00 00 00 00 2b 70 62 77 |ì..è+pbw| > 05d13fc0 01 1b 2a 03 00 00 1b 2a 04 00 00 00 1a 00 02 02 |..**| > 05d13fd0 00 18 00 ec 19 13 e8 00 00 00 00 2b 70 62 77 01 |...ì..è+pbw.| > 05d13fe0 1b 2a 03 00 00 1b 2a 04 00 00 00 1a 00 02 02 00 |.**.| > 05d13ff0 18 00 ec 19 13 e8 00 00 00 00 2b 70 62 77 01 1b |..ì..è+pbw..| > [... and so on ...] > > This pattern gets repeated all the time. Using http://pbw.id.au/lexmark/protocol.html we can decode this. Starting at 05d13f83: VERTICAL MOVE (1b 2a 03) by 0 SWIPE PRINT (1b 2a 04) of length 26 (00 00 00 1a): unidirectional, 600x600 dpi (00 02) color (02 00) 192 nozzles (18) 00 padding 60441 columns (ec 19) first column = 5096 (13 e8) last column = 0 (00 00) --- huh? doesn't add up driver id = "+pbw" (2b 70 62 77) time for data (01) VERTICAL MOVE (1b 2a 03) by 0 SWIPE PRINT (1b 2a 04) of length 26 (00 00 00 1a): ... That's what FILL_SWIPE_HEADER writes (in contrib/gdevlx50.c), in printSwipe(). So printSwipe() is being called interspersed with feedPaper(), just as Sebastian described. The tried and true printf method reveals that nextLineToPrint very quickly gets the value of 16, which is much lower than 3300, and keeps that value. But at this point I'm stuck, since I'm not sure how this code is supposed to work. When is nextLineToPrint supposed to advance? It's also possible the postscript file is buggy, though it displays ok with the x11 driver, at least. The ps file came from an attempt to print something with a web browser. Ideas? Jonathan [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;bug=343901 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#343901: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files
reassign 343901 libgs9 found 343901 gs-esp/8.15.1.dfsg.1-1 found 343901 ghostscript/9.00~dfsg-2 tags 343901 + confirmed quit Sebastian Schmidt wrote: > gs-esp with -sDEVICE=lx5000 hangs when printing PostScript files > generated by mozilla (firefox, in this case). I have attached a file > which causes gs to fail; you can reproduce this bug with > gs -sDEVICE=lx5000 -sOutputFile=/dev/null file > > gs without -sDEVICE or gv display the file fine. Thanks for a clear report. Still happens exactly as described. Ghostscript wizards: any ideas for tracking this down? $ gs -dSAFER -sDEVICE=lx5000 -sOutputFile=/dev/null ~/web/mozilla.ps GPL Ghostscript 9.00 (2010-09-14) Copyright (C) 2010 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading NimbusRomNo9L-Regu font from /usr/share/fonts/type1/gsfonts/n021003l.pfb... 2619136 1254085 8750092 7450110 1 done. Loading NimbusRomNo9L-Medi font from /usr/share/fonts/type1/gsfonts/n021004l.pfb... 2682564 1363434 8750092 7456503 1 done. Loading NimbusRomNo9L-MediItal font from /usr/share/fonts/type1/gsfonts/n021024l.pfb... 2799708 1471362 8770188 7466010 1 done. Loading NimbusRomNo9L-ReguItal font from /usr/share/fonts/type1/gsfonts/n021023l.pfb... 2916852 1582897 8770188 7472159 1 done. Loading NimbusSanL-Regu font from /usr/share/fonts/type1/gsfonts/n019003l.pfb... 3013900 1678963 8770188 7478372 1 done. Loading NimbusSanL-Bold font from /usr/share/fonts/type1/gsfonts/n019004l.pfb... 3090852 1764420 8790284 7487849 1 done. Loading NimbusSanL-BoldItal font from /usr/share/fonts/type1/gsfonts/n019024l.pfb... 3187900 1852077 8790284 7493998 1 done. Loading NimbusSanL-ReguItal font from /usr/share/fonts/type1/gsfonts/n019023l.pfb... 3284948 1938835 8790284 7500147 1 done. Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 3402092 2053607 8810380 7509624 1 done. Loading NimbusMonL-Bold font from /usr/share/fonts/type1/gsfonts/n022004l.pfb... 3519236 2175599 8810380 7515901 1 done. Loading NimbusMonL-BoldObli font from /usr/share/fonts/type1/gsfonts/n022024l.pfb... 3574036 2193018 8810380 7465778 1 done. Loading NimbusMonL-ReguObli font from /usr/share/fonts/type1/gsfonts/n022023l.pfb... 3671084 2300599 8810380 7471927 1 done. Loading StandardSymL font from /usr/share/fonts/type1/gsfonts/s05l.pfb... 3711276 2340770 8810380 7478380 1 done. [hangs there at 100% CPU] Attaching with gdb gives (gdb) bt #0 0xb7218041 in ?? () from /usr/lib/libgs.so.9 #1 0xb7219822 in ?? () from /usr/lib/libgs.so.9 #2 0xb710bbd0 in gx_default_print_page_copies () from /usr/lib/libgs.so.9 #3 0xb710bd05 in gdev_prn_output_page () from /usr/lib/libgs.so.9 #4 0xb7276ec3 in gs_output_page () from /usr/lib/libgs.so.9 #5 0xb70806df in ?? () from /usr/lib/libgs.so.9 #6 0xb7050fc4 in ?? () from /usr/lib/libgs.so.9 #7 0xb7052030 in gs_interpret () from /usr/lib/libgs.so.9 #8 0xb7045df8 in gs_main_run_string_end () from /usr/lib/libgs.so.9 #9 0xb7046252 in gs_main_run_string_with_length () from /usr/lib/libgs.so.9 #10 0xb70462aa in gs_main_run_string () from /usr/lib/libgs.so.9 #11 0xb7047060 in ?? () from /usr/lib/libgs.so.9 #12 0xb70478f8 in ?? () from /usr/lib/libgs.so.9 #13 0xb7047b6a in ?? () from /usr/lib/libgs.so.9 #14 0xb7048feb in gs_main_init_with_args () from /usr/lib/libgs.so.9 #15 0xb704a10e in gsapi_init_with_args () from /usr/lib/libgs.so.9 #16 0x0804887c in main () Using the usual X11 driver gives the same terminal output, with >>showpage, press to continue<< appended and a webpage shows. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org