Unknown threads on pdf to jpg rendering with java

Our production flooded with blocked threads spawning, like 100 per day. All with identical stacktrace.

Thread 13633: (state = BLOCKED)
  • java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
  • java.lang.Object.wait() @bci=2, line=502 (Interpreted frame)
  • com.aspose.pdf.internal.l57l.l3k.lI(int, boolean) @bci=41 (Interpreted frame)
  • com.aspose.pdf.internal.l57l.l3k.dd_() @bci=3 (Interpreted frame)
  • com.aspose.pdf.internal.l47if.lf$lI.lj() @bci=4 (Interpreted frame)
  • com.aspose.pdf.internal.l47if.lb.ld() @bci=55 (Interpreted frame)
  • com.aspose.pdf.internal.l47if.lb.lI(com.aspose.pdf.internal.l47if.lb) @bci=1 (Interpreted frame)
  • com.aspose.pdf.internal.l47if.lb$1.lI() @bci=4 (Interpreted frame)
  • com.aspose.pdf.internal.l47if.lf$lI$1.lI(java.lang.Object) @bci=25 (Interpreted frame)
  • com.aspose.pdf.internal.l57l.l1j.lI(java.lang.Object) @bci=5 (Interpreted frame)
  • com.aspose.pdf.internal.l57l.l1n.run() @bci=11 (Interpreted frame)
  • java.lang.Thread.run() @bci=11, line=748 (Interpreted frame)

and few with:

Thread 9277: (state = BLOCKED)
  • java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
  • java.lang.Object.wait() @bci=2, line=502 (Compiled frame)
  • com.aspose.pdf.internal.l57l.l3k.lI(int, boolean) @bci=41 (Compiled frame)
  • com.aspose.pdf.internal.l57l.l3k.dd_() @bci=3 (Compiled frame)
  • com.aspose.pdf.internal.l47if.lh.lI(boolean) @bci=4 (Compiled frame)
  • com.aspose.pdf.internal.l47if.lk.dispose() @bci=2 (Compiled frame)
  • com.aspose.pdf.internal.html.dom.Document.navigate(com.aspose.pdf.internal.html.dom.Document$lj) @bci=212 (Compiled frame)
  • com.aspose.pdf.internal.html.dom.Document.(com.aspose.pdf.internal.html.lj, com.aspose.pdf.internal.html.dom.Document$lI) @bci=25 (Compiled frame)
  • com.aspose.pdf.internal.html.HTMLDocument.(com.aspose.pdf.internal.html.net.RequestMessage, com.aspose.pdf.internal.html.Configuration, byte) @bci=18 (Compiled frame)
  • com.aspose.pdf.internal.html.HTMLDocument.(com.aspose.pdf.internal.html.Url, com.aspose.pdf.internal.html.Configuration) @bci=7 (Compiled frame)
  • com.aspose.pdf.internal.html.rendering.EpubRenderer.convertXHTML(com.aspose.pdf.internal.l36l.lb$lI, com.aspose.pdf.internal.html.Configuration, com.aspose.pdf.internal.ms.System.l10j) @bci=9 (Compiled frame)
  • com.aspose.pdf.internal.html.rendering.EpubRenderer.addDocumentSources(com.aspose.pdf.internal.html.Configuration, com.aspose.pdf.internal.l36l.lt, com.aspose.pdf.internal.ms.System.Collections.Generic.l0t, com.aspose.pdf.internal.html.net.MessageHandler, com.aspose.pdf.internal.ms.System.l10j) @bci=131 (Interpreted frame)
  • com.aspose.pdf.internal.html.rendering.EpubRenderer.render(com.aspose.pdf.internal.html.rendering.IDevice, com.aspose.pdf.internal.html.Configuration, com.aspose.pdf.internal.ms.System.l10j, com.aspose.pdf.internal.ms.System.IO.Stream[]) @bci=105 (Interpreted frame)
  • com.aspose.pdf.internal.html.rendering.EpubRenderer.render(com.aspose.pdf.internal.html.rendering.IDevice, com.aspose.pdf.internal.ms.System.l10j, com.aspose.pdf.internal.ms.System.IO.Stream[]) @bci=14 (Interpreted frame)
  • com.aspose.pdf.internal.html.rendering.EpubRenderer.render(com.aspose.pdf.internal.html.rendering.IDevice, com.aspose.pdf.internal.ms.System.l10j, java.lang.Object[]) @bci=7 (Interpreted frame)
  • com.aspose.pdf.internal.html.rendering.Renderer.render(com.aspose.pdf.internal.html.rendering.IDevice, java.lang.Object, com.aspose.pdf.internal.ms.System.l10j) @bci=28 (Interpreted frame)
  • com.aspose.pdf.internal.html.rendering.Renderer.render(com.aspose.pdf.internal.html.rendering.IDevice, java.lang.Object) @bci=9 (Interpreted frame)
  • com.aspose.pdf.l4k.lI(com.aspose.pdf.internal.ms.System.IO.Stream, com.aspose.pdf.IDocument, com.aspose.pdf.EpubLoadOptions) @bci=222 (Interpreted frame)
  • com.aspose.pdf.ADocument.lI(com.aspose.pdf.internal.ms.System.IO.Stream, com.aspose.pdf.LoadOptions) @bci=500 (Interpreted frame)
  • com.aspose.pdf.ADocument.(com.aspose.pdf.internal.ms.System.IO.Stream, com.aspose.pdf.LoadOptions) @bci=189 (Interpreted frame)
  • com.aspose.pdf.Document.(java.io.InputStream, com.aspose.pdf.LoadOptions) @bci=6 (Interpreted frame)
  • com.keepit.aspose.task.PdfPreviewGeneratorTask.initDocument(com.keepit.utils.ThumbnailFormat) @bci=360, line=76 (Interpreted frame)
  • com.keepit.aspose.task.PdfPreviewGeneratorTask.generate(java.io.OutputStream, com.keepit.utils.ThumbnailFormat) @bci=2, line=37 (Interpreted frame)
  • com.keepit.aspose.server.RequestProcessor.generatePreviewDependsOnType(com.keepit.utils.KeepitInputStream, java.io.ByteArrayOutputStream) @bci=43, line=195 (Compiled frame)
  • com.keepit.aspose.server.RequestProcessor.processAsposeTransformRequest(java.io.OutputStream) @bci=98, line=168 (Compiled frame)
  • com.keepit.aspose.server.RequestProcessor.run() @bci=128, line=66 (Compiled frame)
  • java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=95, line=1142 (Interpreted frame)
  • java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=617 (Interpreted frame)
  • java.lang.Thread.run() @bci=11, line=748 (Interpreted frame)

I am no able to reproduce this on test environment. Our code looks like
InputStream in = new FileInputStream(new File(“pdf.pdf”));
Document pdfDocument = new Document(in);
PdfConverter converter = new PdfConverter(pdfDocument);
try {
converter.setStartPage(1);
converter.setEndPage(1);
converter.doConvert();
converter.getNextImage(new FileOutputStream(new File(“jpg.jpg”)), ImageType.getJpeg(), 1024, 768, 70);
} finally {
converter.close();
}

Running on Ubuntu 16, Oracle JDK 8 . Any ideas what that could be?

@mrila

We are afraid that we cannot determine the cause of this issue or comment on it without replicating it on our side. Furthermore, please try using DOM approach to convert PDF Pages into Images with latest available version of the API and let us know in case you still face any issue by sharing a sample application which is able to reproduce the issue at our side. We will surely further proceed to assist you accordingly.