Ghostscript process does not exit

880 views
Skip to first unread message

Tech Patriot

unread,
Apr 6, 2010, 2:56:47 PM4/6/10
to ResourceSpace
I'm running ResourceSpace on a Windows Server 2008 R2 with IIS7.5, PHP
5.3.2, and MySQL 5.1. Everything is working very well except for one
area. For some reason my Ghostscript process "hangs" when trying to
create a contact sheet, no matter the number of pictures or contact
sheet configuration. The "Loading" text appears, but nothing happens
until I manually kill the gs.exe process using Windows Task Manager.
The moment I kill the process the preview DOES appear. If I leave the
gs.exe process running I can click the "Create" button and I can
download a PDF of the contact sheet even without the preview
appearing. However, if I back in and out of the contact sheet feature
page several gs.exe processes will start for each occurrence. At that
point I cannot download a PDF version of the contact until I manually
kill each of the gs.exe processes.

I've tried installing several versions of Ghostscript ranging from
8.54 through 8.71 and using 32-bit and 64-bit variants too.

I can successfully upload PDFs to ResourceSpace and my thumbnails and
full page previews are generated perfectly. During the upload of a
PDF I can see the gs.exe process running and closing properly when the
upload process completes.

Interestingly, I had this same problem running on Windows Server 2003
and IIS6.

Are there any thoughts on this? Thanks ahead of time.

Tom Gleason

unread,
Apr 6, 2010, 3:13:12 PM4/6/10
to resour...@googlegroups.com
I don't have a windows server to test on, so I don't really know what
might be going wrong here (and that may be the problem!)

Can you find any errors or anything that would suggest what is getting held up?

> --
> You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
> To post to this group, send email to resour...@googlegroups.com.
> To unsubscribe from this group, send email to resourcespac...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.
>
>

--
Tom Gleason, PHP Developer
DBA Impressive Design

Exploring ResourceSpace at:
http://resourcespace.blogspot.com

Tech Patriot

unread,
Apr 6, 2010, 3:40:48 PM4/6/10
to ResourceSpace
Hi Tom and thanks for your speedy feedback.

At the moment I don't have any errors that appear, but I also don't
have any sort of logging turned on either for Ghostscript. Actually,
I don't know if anything exists. I checked the Windows Event viewer
and didn't see any problems listed there.

I'm wondering if there's a way to pass a "-dBATCH" or "-c quit" switch
at the end of the gs command that ResourceSpace issues for execution?
I was reading about that possibility here:
http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#Interaction_related_parameters

The CPU utilization of gs.exe process just sits at 0% when viewing the
contact sheet page and the memory utilitzation stays the same and does
not grow either, so I'm not sure what's going on with it. Is there a
way to see the actual command that RS issues when it needs it?

Thanks,
John

> > For more options, visit this group athttp://groups.google.com/group/resourcespace?hl=en.

Tom Gleason

unread,
Apr 6, 2010, 4:02:52 PM4/6/10
to resour...@googlegroups.com
Sounds like you are capable of doing some debug.

have a look at contactsheet.php, which has grown probably overly
complex (since i added some extra font supports for linux) but you
might try adding -dBATCH to the ghostscript command (somewhere around
line 330..) and otherwise compare that command with the commands in
preview_preprocessing that ARE working for you.

> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.

Tech Patriot

unread,
Apr 6, 2010, 4:25:35 PM4/6/10
to ResourceSpace
Thank you very much Tom!

I found the command in contactsheet.php like you said. I changed the
following line from this:

if (!file_exists($command)) {$command= $ghostscript_path. "\gs.exe";}

to this:

if (!file_exists($command)) {$command= $ghostscript_path. "\gs.exe -c
quit";}

...and the contact sheet preview now works perfectly along with the
creation of the PDF. It's also very fast too in that the gs.exe
process doesn't run long enough to even appear in the process list of
Windows Task Manager. The CPU utilization pops up to 15% for a split
second and then it's done.

Also, I checked uploading PDFs and my thumbnail creation and full
screen previews are still created successfully too. I was fearing
that I'd fix one area, but screw up another for a moment.

BTW, what's the code editor you use? WordPad works fine, but I like
the one you were using in your YouTube RS demonstration videos.

Thanks again Tom.

John

On Apr 6, 3:02 pm, Tom Gleason <theorysav...@gmail.com> wrote:
> Sounds like you are capable of doing some debug.
>
> have a look at contactsheet.php, which has grown probably overly
> complex (since i added some extra font supports for linux) but you
> might try adding -dBATCH to the ghostscript command (somewhere around
> line 330..) and otherwise compare that command with the commands in
> preview_preprocessing that ARE working for you.
>
>
>
>
>
> On Tue, Apr 6, 2010 at 3:40 PM, Tech Patriot <j...@techpatriot.com> wrote:
> > Hi Tom and thanks for your speedy feedback.
>
> > At the moment I don't have any errors that appear, but I also don't
> > have any sort of logging turned on either for Ghostscript.  Actually,
> > I don't know if anything exists.  I checked the Windows Event viewer
> > and didn't see any problems listed there.
>
> > I'm wondering if there's a way to pass a "-dBATCH" or "-c quit" switch
> > at the end of the gs command that ResourceSpace issues for execution?
> > I was reading about that possibility here:

> >http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#Interaction_related_p...

Tom Gleason

unread,
Apr 6, 2010, 4:30:26 PM4/6/10
to resour...@googlegroups.com
Can you explain why that works? If you're confident that it does, it
might be added to the base. Please do some testing and let me know.

I use Geany on Linux....really great editor.

> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.

Tech Patriot

unread,
Apr 7, 2010, 11:07:20 AM4/7/10
to ResourceSpace
Oops, I've taken a closer look at this. It appears that with the "-c
quit" switch the preview thumbnail that appears is actually never
updated or changed. It simply shows the last contactsheet.jpg file
created before turning on the new switch. The "create" button does
work, however, and the PDF is the correct current one. Without using
the "-c quit" switch, the "create" button worked too, but the preview
never appeared and the word "Loading" just stayed there, so really the
results are "six of one or half dozen of the other".

Next I tried using the "-dBATCH" switch. Interestingly, the preview
DID appear AND it was the correct one each time I made changes to the
preview settings. However, I would have to click the "create" button
two times in a row in order to bring up the "save as" dialog box.
Some times when I clicked the "create" button I would get a "500
internal server error" page too. It's looking like "-dBATCH" actually
causes more problems than it's worth.

The results were identical between Windows Server 2003 32-bit with
IIS6 and Windows Server 2008 R2 (this OS is only available as 64-bit)
with IIS 7.5.

Maybe a combination of switches will help remedy this, so I'll
continue to hack around a bit.

Thanks,
John

Tom Gleason

unread,
Apr 7, 2010, 11:13:29 AM4/7/10
to resour...@googlegroups.com
Sorry to hear that. I haven't seen any similar problems running on
Ubuntu server. Keep me updated.

> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.

Tech Patriot

unread,
Apr 7, 2010, 12:58:29 PM4/7/10
to ResourceSpace
Ok, now I think I have it.

Changing this line in contactsheet.php:

$command.= " -sDEVICE=jpeg -dFirstPage=$previewpage -r100 -dLastPage=
$previewpage -sOutputFile=\"".

to this:

$command.= " -sDEVICE=jpeg -dFirstPage=$previewpage -r100 -o -
dLastPage=$previewpage -sOutputFile=\"".

Seems to have fixed all issues on a Windows system.

The "-o" is the same as "-dBATCH -dNOPAUSE".

Placing the "-o" in the correct spot was also important. It should
not go with "gs.exe" or placed before the "-dFirstPage" switch either
in the $command line.

Thanks,
John

Tom Gleason

unread,
Apr 7, 2010, 1:08:44 PM4/7/10
to resour...@googlegroups.com
great, thanks, I committed this.

> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.

Reply all
Reply to author
Forward
0 new messages