Aspose thread running too long for some cases

Sometimes we run into java threads running too long like more than 4 hours while creating PDF file.

Here is the sample code

        com.aspose.pdf.Document doc = new com.aspose.pdf.Document("add file path");
        com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document();

        PageCollection origPages = doc.getPages();
        PageCollection subsetPages = pdfDoc.getPages();
        for (Integer page : pages) {
            Page pageObj = origPages.get_Item(page);
            subsetPages.add(pageObj);
        }
        pdfDoc.save(tempBlob.getAbsolutePath());
        doc.close();
        pdfDoc.close();

Here are few stacktraces we found

Sometimes while using aspose
java.lang.Thread.State: RUNNABLE 3 at com.aspose.pdf.internal.l1v.l1v.lI(Unknown Source) 4 at com.aspose.pdf.PageCollection.getUnrestricted(Unknown Source) 5 - locked <0x0000000690600290> (a com.aspose.pdf.Document) 6 at com.aspose.pdf.PageCollection.lf(Unknown Source) 7 at com.aspose.pdf.PageCollection.get_Item(Unknown Source)

at com.aspose.pdf.internal.ms.System.Collections.Generic.ld$lI.lI(Unknown Source) 4 at com.aspose.pdf.internal.ms.System.Collections.Generic.lf.containsKey(Unknown Source) 5 at com.aspose.pdf.internal.l0f.lh.lI(Unknown Source) 6 at com.aspose.pdf.internal.l0f.lh.lI(Unknown Source) 7 at com.aspose.pdf.internal.l0f.lh.lI(Unknown Source) 8 at com.aspose.pdf.internal.l5n.l1j.l3y(Unknown Source) 9 at com.aspose.pdf.internal.l5n.l1j.l3v(Unknown Source) 10 at com.aspose.pdf.internal.l1v.l1v.lI(Unknown Source) 11 at com.aspose.pdf.PageCollection.getUnrestricted(Unknown Source)

@Hardeep1784

Can you please define ‘pages’ variable and share source PDF file so that we may try to reproduce the same on our end.