Bug 691783 - Single page PDF->PNG conversion is extremely slow
Summary: Single page PDF->PNG conversion is extremely slow
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.00
Hardware: All All
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-21 15:15 UTC by Christian Birch
Modified: 2010-11-23 15:41 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Problematic PDF (6.19 MB, application/pdf)
2010-11-21 15:15 UTC, Christian Birch
Details
Potential fix. (927 bytes, patch)
2010-11-22 22:23 UTC, Sebastian Rasmussen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Birch 2010-11-21 15:15:40 UTC
Created attachment 6931 [details]
Problematic PDF

Command:

gs -dNumRenderingThreads=1 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dAlignToPixels=0 -dGridFitTT=0 -dFirstPage=11 -dLastPage=11 -dUseCropBox -r250 -sOutputFile=out.png in.pdf

Expected result:

Page 11 should be converted to a PNG file within a *reasonable* time.

Actual result:

It takes forever to convert the PDF->PNG - it *will* do the conversion at some point, though. I was looking at out.png while gs was running and it seems that gs is writing nothing, or null, to the file since the last modified timestamp of the file gets updated every now and then but the file has a length of zero.
Comment 1 Christian Birch 2010-11-21 15:18:37 UTC
For me, the output is:

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.
Processing pages 11 through 11.
Page 11
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 3685228 2255212 3142784 1716788 3 done.

--This is where it will hang for a LONG time but eventually finish at some point.
Comment 2 Sebastian Rasmussen 2010-11-22 22:21:42 UTC
When I ran this test case gs rev 11907 segfaulted on me and running valgrind produced a series of read errors. Assisted by the helpful Robin I managed to track down the problem: in clist_teardown_render_threads() it is not possible to retrieve the locking allocator from a threads memory chunk allocator once that chunk allocator has been released. A patch is attached which may explain it better.
Comment 3 Sebastian Rasmussen 2010-11-22 22:23:33 UTC
Created attachment 6942 [details]
Potential fix.

The attached patch fixes the segfault and the valgrind errors for me.
Comment 4 Robin Watts 2010-11-23 15:41:09 UTC
I cluster tested this patch earlier and found that it caused various SEGVs. It turns out that this was my fault for misapplying the patch - the patch as given here works perfectly.

Having retested the corrected version, it solves the problem and runs cleanly on the cluster.

I've committed it as revision 11911. Apologies to Sebastian for suggesting his patch wasn't right in the svn logs!