Hi team,
We have encountered the issue when signing Digital Signature in Java by using  PdfFileSignature.save() although we created the object for each thread.
Below is the code and thread-dump:
public byte[] signPdf(byte[] pdfBytes) {
        LOG.info("[ASPOSE] Signing pdf");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        Document doc = null;
        PdfFileSignature signature = null;
        try {
            PKCS7 pkcs7 = getPkcs7();
            Rectangle rect = new Rectangle(10, 0, 100, 30);
            doc = new Document(pdfBytes);
            if (doc.isEncrypted()) {
                doc.decrypt();
            }
            signature = new PdfFileSignature(doc);
            signature.sign(1, true, rect, pkcs7);
            signature.save(outputStream);
            return outputStream.toByteArray();
        } catch (Exception e) {
            LOG.error("Failed to sign PDF", e);
            throw new RuntimeException("PDF signing failed", e);
        } finally {
            IOUtils.closeQuietly(doc);
            IOUtils.closeQuietly(signature);
        }
    }
    private PKCS7 getPkcs7() {
        PKCS7 pkcs7 = new PKCS7(new ByteArrayInputStream(pfxFileContent), pdfFilePassword);
        pkcs7.setCustomAppearance(signatureAppearance);
        pkcs7.setShowProperties(true);
        pkcs7.setUseLtv(true);
        return pkcs7;
    }
thread-dump.zip (5.0 KB)