Page 1 of 1

Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-11-21T01:32:42-07:00
by nazakatqureshi
Hi,
We are using ImageMagick and JMagick in our production environment, initially it was really hard to configure everything on Production, Its been almost two month we are using ImageMagick and Jmagick and its worked very good in term of performance, but the problem after every week or two we found that its throws the following error and then we have no other option but to restart the production Weblogic server and everything start working as expected.

Postscript delegate failed `/opt2/jmagick-cache-storage/859e6ae6-fe90-46b8-86c9-caa99e9bea39.pdf':
No such file or directory @ error/pdf.c/ReadPDFImage/678
at magick.MagickImage.readImage(Native Method)


Server environment is:

1- Oracle Enterprise Redhat Linux 7.2
2- WebLogic Server 10.3
3- JDK 1.7
4- ImageMagick 6.7.8
5- Ghostscript 9.18
6- Jmagick Latest

In order to reproduce the problem on local machine I wrote the small program with 100 concurrent thread (all thread read the same file and save it into 'jmagick-cache-storageTest' directory with unique name and then ImageMagick try to generate the thumbnail of saved file , first iteration for all thread its generate thumbnail properly and in second iteration some where after 60th thread it start throwing this error ) and it actually crashed after 30,40 mint and throw the following error:

Postscript delegate failed `/opt2/jmagick-cache-storageTest/859e6ae6-fe90-46b8-86c9-caa99e9bea39.pdf':
No such file or directory @ error/pdf.c/ReadPDFImage/678
at magick.MagickImage.readImage(Native Method)


Local environment is:

1- Centos Linux 7.2
2- JDK 1.7
3- ImageMagick 6.7.8
4- Ghostscript 9.18 (also tried with 9.20)
6- Jmagick Latest

its seems that this is ImageMagick problem, any guidance.

Thanks in advance.

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-11-22T00:50:51-07:00
by nazakatqureshi
Any update

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-11-22T13:38:27-07:00
by dlemstra
Can you upgrade ImageMagick to the latest version? I fixed a multithreading issue in the PDF reader a while back.

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-12-01T01:20:19-07:00
by nazakatqureshi
we are using 6.7.8 becuase latest version cause to generate the black thumbnail problem. can you kindly suggest me what should be the best values for policy.xml file for the server with specification:

1. CPU details

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 62
Model name: Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
Stepping: 4
CPU MHz: 3000.000
BogoMIPS: 6000.00
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 25600K
NUMA node0 CPU(s): 0-15
NUMA node1 CPU(s):


2. Total Ram on Server: 48 GB
Allocated to Weblogic : 32 GB

3. Available space at location /opt2 on the server:
Available = 41G


as on Local machine I manage to solve the issue with policy.xml file. but same configuration cause the problem on production.

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-12-01T01:24:27-07:00
by nazakatqureshi
and secondly any idea why the temp file (magick-****) not getting deleted, although we are using crone job to delete the files after every one hour.

I noticed that whenever there is high server loads, it crashed. I suspect that might be because of these temp file which are not getting deleted. ANY suggestion ?

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-12-01T10:17:03-07:00
by fmw42
Post the issue of the black thumbnail problem. What version of IM? Post a link to an example input and output image. That should be fixed if it is a real issue. Then you can upgrade. Also what version of Ghostscript are you using? Have you tried upgrading to the latest version of that?

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-12-13T01:49:08-07:00
by nazakatqureshi
Anyhow as per your suggestion I upgraded the Imagemagick on our test environement, and find out new problem :?

ImageMagick:

Version: ImageMagick 6.9.6-8 Q16 x86_64 2016-12-11 http://www.imagemagick.org
Copyright: Copyright 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig jng jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib

GhostScript:
GPL Ghostscript 9.20 (2016-09-26)
Copyright (C) 2016 Artifex Software, Inc. All rights reserved.

Commnad to generate pdf to jpg or PNG :

> convert thumnailproblem.pdf th.jpg
>convert thumnailproblem.pdf th.png

generate the empty/Blank Images. which was working fine the old version which I have.

Please note that only few pdf file have this issue, for othter pdf it just worked fine.

Re: Postscript delegate failed in multithreaded environment (Java, Jmagick)

Posted: 2016-12-13T08:33:15-07:00
by magick
Can you view the PDF with this command: gs 'Blank Thumbnail SVU.pdf'? Do you get expected results? If so, does ImageMagick render the PDF from the command line, e.g. convert my.pdf my.gif? If so, perhaps its a threading issue. Rebuild ImageMagick from source. Add --without-gslib to your configure command-line, e.g. configure --without-gslib. Now build and install ImageMagick. Does the PDF render now in a threaded environment? If so, let us know. We may need to single thread Ghostscript execution.