The customer reports: We are currentlyusing the gs8.54. The file can be viewed (which already takes a little bit), however if you try -sDEVICE=tiff24nc and -r400x400 it takes over an hour or longer to render the complete file. Admittedly the PDF-file has a size of 90 X 200 cm, but we have PDF files of similar size and it never took so long.
Created attachment 2836 [details] e-a-gr-eg_a-oberer_teilplan.pdf
On my 64 bit Linux system gs8.54 at 72 DPI converts this file to PPM in about 2 minutes. With gshead (r7784) the conversion never completes even after many hours.
On my Powerbook s8.54 both gs8.54 and gshead are slow, but finishes.
The last comment should have been "gs8.54 and gshead".
Further testing reveals that gshead is faster at converting the test file than gs854 on my G4 PowerBook. I'm running search-svn-revs now to find the relevant change(s).
I ran search-svn-revs to find the revision that causes ghostscript to hang on my 64 bit Linux system. It appears that r7694 is the first version that exhibits the problem. Here is the change from r7693 to r7694: 14c14 < /* $Id: ialloc.c 7668 2007-02-02 04:47:29Z leonardo $ */ --- > /* $Id: ialloc.c 7694 2007-02-12 14:06:50Z alexcher $ */ 188,189d187 < ref_packed **ppr = 0; < int code = 0; 191,195d188 < if ((gs_memory_t *)mem != mem->stable_memory) { < code = alloc_save_change_alloc(mem, "gs_alloc_ref_array", &ppr); < if (code < 0) < return code; < } 220,221c213,220 < if (ppr) < *ppr = (ref_packed *)obj; --- > if ((gs_memory_t *)mem != mem->stable_memory) { > ref_packed **ppr = 0; > int code = alloc_save_change_alloc(mem, "gs_alloc_ref_array", &ppr); > if (code < 0) > return code; > if (ppr) > *ppr = (ref_packed *)obj; > }
Per an email from Leornado: > It looks as a filters problem. > Please attach all this to the bug report, > and please specify *precise*revision*number*. > Then please assign the bug to Alex, > who handles filters. The revision number is 7792. I compiled and ran the debug ghostscript and it locks up in the same way under 64 bit Linux. I then tried various options and -Z@ causes the problem to go away; I believe this supports your heap corruption hypothesis. I then ran it under the debugger (without the -Z@ option) and it also locks up. Here is the stack trace: (gdb) run -I/home/marcos/Desktop/artifex/ghostscript/trunk/gs/lib -I/home/marcos/Desktop/artifex/fonts -sOutputFile=test.ppm -sDEVICE=ppmraw -dBATCH -dNOPAUSE -r72 ./e-a-gr-eg_a-oberer_teilplan.pdf Starting program: /home/marcos/Desktop/artifex/ghostscript/trunk/gs/debugobj/gs -I/home/marcos/Desktop/artifex/ghostscript/trunk/gs/lib -I/home/marcos/Desktop/artifex/fonts -sOutputFile=test.ppm -sDEVICE=ppmraw -dBATCH -dNOPAUSE -r72 ./e-a-gr-eg_a-oberer_teilplan.pdf GPL Ghostscript SVN PRE-RELEASE 8.57 (2007-03-15) Copyright (C) 2007 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Program received signal SIGINT, Interrupt. image_file_continue (i_ctx_p=0xcd2e38) at ./src/zimage.c:474 474 while ((avail = sbufavailable(s)) <= (gdb) where #0 image_file_continue (i_ctx_p=0xcd2e38) at ./src/zimage.c:474 #1 0x000000000047de29 in call_operator (op_proc=0xcdb648, i_ctx_p=0x7fffff9dce98) at ./src/interp.c:104 #2 0x000000000047f830 in interp (pi_ctx_p=0xcbc298, pref=0xcbec58, perror_object=0x7fffff9df750) at ./src/interp.c:1154 #3 0x000000000047e365 in gs_call_interp (pi_ctx_p=0xcbc298, pref=<value optimized out>, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:490 #4 0x000000000047e223 in gs_interpret (pi_ctx_p=0xcbc298, pref=0x7fffff9df6c0, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:448 #5 0x0000000000474926 in gs_main_interpret (minst=<value optimized out>, pref=0x7fffff9dce98, user_errors=15153504, pexit_code=0xcdb5c8, perror_object=0x0) at ./src/imain.c:214 #6 0x00000000004751f1 in gs_main_run_string_end (minst=0x2, user_errors=-6467872, pexit_code=0xcdb5c8, perror_object=0x0) at ./src/imain.c:529 #7 0x00000000004750dc in gs_main_run_string_with_length (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", length=76, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:487 #8 0x000000000047504c in gs_main_run_string (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:469 #9 0x0000000000477827 in run_string (minst=0x2, str=0x7fffff9dce98 "", options=3) at ./src/imainarg.c:802 #10 0x00000000004777c6 in runarg (minst=0xcbc200, pre=0x70743c "", arg=0xcf43e0 "./e-a-gr-eg_a-oberer_teilplan.pdf", post=0x69ba6c ".runfile", options=3) at ./src/imainarg.c:792 #11 0x000000000047751d in argproc (minst=0xcbc200, arg=0x7fffff9e0783 "./e-a-gr-eg_a-oberer_teilplan.pdf") at ./src/imainarg.c:727 #12 0x000000000047624f in gs_main_init_with_args (minst=0xcbc200, argc=9, argv=<value optimized out>) at ./src/imainarg.c:211 #13 0x0000000000404594 in main (argc=9, argv=0x7fffff9e0298) at ./src/gs.c:77 I restarted the code and stopped it a couple of additional times, with these results: (gdb) cont Continuing. Program received signal SIGINT, Interrupt. 0x00000000004fb206 in gx_image3x_plane_data (info=<value optimized out>, planes=0x143c818, height=1, rows_used=0x7fffff9d4fc4) at ./src/gximag3x.c:753 753 } (gdb) where #0 0x00000000004fb206 in gx_image3x_plane_data (info=<value optimized out>, planes=0x143c818, height=1, rows_used=0x7fffff9d4fc4) at ./src/gximag3x.c:753 #1 0x0000000000cd2e38 in ?? () #2 0x00000000004a75a7 in image_file_continue (i_ctx_p=0x2) at ./src/zimage.c:519 #3 0x000000000047de29 in call_operator (op_proc=0, i_ctx_p=0x143c818) at ./src/interp.c:104 #4 0x000000000047f830 in interp (pi_ctx_p=0xcbc298, pref=0xcbec58, perror_object=0x7fffff9df750) at ./src/interp.c:1154 #5 0x000000000047e365 in gs_call_interp (pi_ctx_p=0xcbc298, pref=<value optimized out>, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:490 #6 0x000000000047e223 in gs_interpret (pi_ctx_p=0xcbc298, pref=0x7fffff9df6c0, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:448 #7 0x0000000000474926 in gs_main_interpret (minst=<value optimized out>, pref=0x143c818, user_errors=1, pexit_code=0x10d3228, perror_object=0x0) at ./src/imain.c:214 #8 0x00000000004751f1 in gs_main_run_string_end (minst=0x8, user_errors=-6467872, pexit_code=0x10d3228, perror_object=0x0) at ./src/imain.c:529 #9 0x00000000004750dc in gs_main_run_string_with_length (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", length=76, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:487 #10 0x000000000047504c in gs_main_run_string (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:469 #11 0x0000000000477827 in run_string (minst=0x8, str=0x143c818 "\036+?", options=3) at ./src/imainarg.c:802 #12 0x00000000004777c6 in runarg (minst=0xcbc200, pre=0x70743c "", arg=0xcf43e0 "./e-a-gr-eg_a-oberer_teilplan.pdf", post=0x69ba6c ".runfile", options=3) at ./src/imainarg.c:792 #13 0x000000000047751d in argproc (minst=0xcbc200, arg=0x7fffff9e0783 "./e-a-gr-eg_a-oberer_teilplan.pdf") at ./src/imainarg.c:727 #14 0x000000000047624f in gs_main_init_with_args (minst=0xcbc200, argc=9, argv=<value optimized out>) at ./src/imainarg.c:211 #15 0x0000000000404594 in main (argc=9, argv=0x7fffff9e0298) at ./src/gs.c:77 (gdb) cont Continuing. Program received signal SIGINT, Interrupt. 0x000000000061f432 in gs_image_next_planes (penum=0x1427bd8, plane_data=0x7fffff9d5010, used=0x7fffff9dce90) at ./src/gsimage.c:499 499 for (i = 0; i < num_planes; ++i) { (gdb) where #0 0x000000000061f432 in gs_image_next_planes (penum=0x1427bd8, plane_data=0x7fffff9d5010, used=0x7fffff9dce90) at ./src/gsimage.c:499 #1 0x00000000004a75a7 in image_file_continue (i_ctx_p=0xcd2e38) at ./src/zimage.c:519 #2 0x000000000047de29 in call_operator (op_proc=0xe82b1e, i_ctx_p=0x7fffff9dce98) at ./src/interp.c:104 #3 0x000000000047f830 in interp (pi_ctx_p=0xcbc298, pref=0xcbec58, perror_object=0x7fffff9df750) at ./src/interp.c:1154 #4 0x000000000047e365 in gs_call_interp (pi_ctx_p=0xcbc298, pref=<value optimized out>, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:490 #5 0x000000000047e223 in gs_interpret (pi_ctx_p=0xcbc298, pref=0x7fffff9df6c0, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:448 #6 0x0000000000474926 in gs_main_interpret (minst=<value optimized out>, pref=0x7fffff9dce98, user_errors=21134296, pexit_code=0x1, perror_object=0x2) at ./src/imain.c:214 #7 0x00000000004751f1 in gs_main_run_string_end (minst=0x1427c28, user_errors=-6467872, pexit_code=0x1, perror_object=0x2) at ./src/imain.c:529 #8 0x00000000004750dc in gs_main_run_string_with_length (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", length=76, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:487 #9 0x000000000047504c in gs_main_run_string (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:469 #10 0x0000000000477827 in run_string (minst=0x1427c28, str=0x7fffff9dce98 "", options=3) at ./src/imainarg.c:802 #11 0x00000000004777c6 in runarg (minst=0xcbc200, pre=0x70743c "", arg=0xcf43e0 "./e-a-gr-eg_a-oberer_teilplan.pdf", post=0x69ba6c ".runfile", options=3) at ./src/imainarg.c:792 #12 0x000000000047751d in argproc (minst=0xcbc200, arg=0x7fffff9e0783 "./e-a-gr-eg_a-oberer_teilplan.pdf") at ./src/imainarg.c:727 #13 0x000000000047624f in gs_main_init_with_args (minst=0xcbc200, argc=9, argv=<value optimized out>) at ./src/imainarg.c:211 #14 0x0000000000404594 in main (argc=9, argv=0x7fffff9e0298) at ./src/gs.c:77 (gdb) cont Continuing. Program received signal SIGINT, Interrupt. 0x000000000061f3ea in gs_image_next_planes (penum=0x1427bd8, plane_data=0x7fffff9d5010, used=0x7fffff9dce90) at ./src/gsimage.c:553 553 } else if (pos == 0 && size >= raster) { (gdb) where #0 0x000000000061f3ea in gs_image_next_planes (penum=0x1427bd8, plane_data=0x7fffff9d5010, used=0x7fffff9dce90) at ./src/gsimage.c:553 #1 0x00000000004a75a7 in image_file_continue (i_ctx_p=0xcd2e38) at ./src/zimage.c:519 #2 0x000000000047de29 in call_operator (op_proc=0x1428b00, i_ctx_p=0x7fffff9dce98) at ./src/interp.c:104 #3 0x000000000047f830 in interp (pi_ctx_p=0xcbc298, pref=0xcbec58, perror_object=0x7fffff9df750) at ./src/interp.c:1154 #4 0x000000000047e365 in gs_call_interp (pi_ctx_p=0xcbc298, pref=<value optimized out>, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:490 #5 0x000000000047e223 in gs_interpret (pi_ctx_p=0xcbc298, pref=0x7fffff9df6c0, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/interp.c:448 #6 0x0000000000474926 in gs_main_interpret (minst=<value optimized out>, pref=0x7fffff9dce98, user_errors=21134081, pexit_code=0x1, perror_object=0x2) at ./src/imain.c:214 #7 0x00000000004751f1 in gs_main_run_string_end (minst=0x1427c28, user_errors=-6467872, pexit_code=0x1, perror_object=0x2) at ./src/imain.c:529 #8 0x00000000004750dc in gs_main_run_string_with_length (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", length=76, user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:487 #9 0x000000000047504c in gs_main_run_string (minst=0xcbc200, str=0xe939c0 "<2e2f652d612d67722d65675f612d6f62657265725f7465696c706c616e2e706466>.runfile", user_errors=1, pexit_code=0x7fffff9df76c, perror_object=0x7fffff9df750) at ./src/imain.c:469 #10 0x0000000000477827 in run_string (minst=0x1427c28, str=0x7fffff9dce98 "", options=3) at ./src/imainarg.c:802 #11 0x00000000004777c6 in runarg (minst=0xcbc200, pre=0x70743c "", arg=0xcf43e0 "./e-a-gr-eg_a-oberer_teilplan.pdf", post=0x69ba6c ".runfile", options=3) at ./src/imainarg.c:792 #12 0x000000000047751d in argproc (minst=0xcbc200, arg=0x7fffff9e0783 "./e-a-gr-eg_a-oberer_teilplan.pdf") at ./src/imainarg.c:727 #13 0x000000000047624f in gs_main_init_with_args (minst=0xcbc200, argc=9, argv=<value optimized out>) at ./src/imainarg.c:211 #14 0x0000000000404594 in main (argc=9, argv=0x7fffff9e0298) at ./src/gs.c:77
I think there are 2 problems here: - the infinite loop that happens during interpretation - rather slow rendering The following patch appears to fix the infinite loop, although I don't understand why does it happen. Valgrind doesn't report any errors in Zlib code. Marcos, please try the patch on your box. Index: gs/src/szlibc.c =================================================================== --- gs/src/szlibc.c (revision 7792) +++ gs/src/szlibc.c (working copy) @@ -91,6 +91,7 @@ gs_free_object(mem, block, "s_zlib_alloc(block)"); return Z_NULL; } + memset(data, 0, size); block->data = data; block->next = zds->blocks; block->prev = 0;
Unfortunately the patch does not fix the infinite loop problem on my AMD64 Ubuntu Linux system.
Created attachment 2852 [details] patch Don't check current row position in the mask of the image type 3x when the mask is not defined. Fix an infinite loop. I'm testing the patch now and runing the profiler to address the main issue - slow rendering of the sample file.
The patch from the comment #10 passes both CET and Comparefiles tests without any observed differences. Here are results of profiling at 400 dpi, uncompressed TIFF, performed on x86, GCC 3.3.5, gprof. % cumulative self self total time seconds seconds calls Ks/call Ks/call name 33.89 1168.74 1168.74 2667149172 0.00 0.00 gs_memmove 21.06 1895.04 726.30 5011603 0.00 0.00 gs_memset 8.40 2184.60 289.56 1724456369 0.00 0.00 c_pdf14trans_read 3.40 2301.86 117.26 930257362 0.00 0.00 sgets 3.32 2416.52 114.66 2423 0.00 0.00 clist_playback_band 2.79 2512.88 96.36 970786710 0.00 0.00 gs_memcpy 2.69 2605.52 92.64 1725168072 0.00 0.00 gs_create_pdf14trans 2.41 2688.50 82.98 1724456369 0.00 0.00 gs_imager_setmatrix 1.55 2741.89 53.40 936017778 0.00 0.00 stream_move 1.37 2789.08 47.19 1728537599 0.00 0.00 large_freelist_alloc 1.30 2833.92 44.84 1725899611 0.00 0.00 s_std_init 1.26 2877.23 43.31 1724456369 0.00 0.00 sget_matrix 1.24 2920.04 42.81 816531672 0.00 0.00 cmd_write_band 1.10 2958.07 38.03 7662950 0.00 0.00 chunk_locate_ptr 1.07 2994.88 36.81 1724456369 0.00 0.00 read_create_compositor 1.03 3030.45 35.57 1742352463 0.00 0.00 i_free_object 1.01 3065.17 34.72 1724461215 0.00 0.00 gx_imager_setscreenphase
The latest patch did fix the infinite loop problem on my 64 bit system. Thanks.
*** Bug 688912 has been marked as a duplicate of this bug. ***
The patch from the comment #10 is committed as rev. 7801.
Starting from the ver. 8.62 rendering of the sample file takes about 5 min on a mid-range PC. Please upgrade.