Deadlock occurred while calculateFormula() on workbook

Hello Aspose Team,

When we tried to generate a PDF file through template/excel file, we encountered the deadlock type condition/error while calculateFormula() operation performed on the workbook. PDF generation works fine if we do not invoke the calculateFormula() method/API on the workbook but we are required to use that api. Sample template/excel file and executable code are as follows.

Sample Template/Excel file: sampleTemplate.zip (281.1 KB)

Sample Code:

   public static void generatePDF() {
                    FileInputStream io = new FileInputStream(new 
  File("/home/brpokharel/Documents/sampleTemplate.xlsx"));

        Workbook workbook = new Workbook(io);
        println " Before=====calculateFormula()1111"
        workbook.calculateFormula();
        println " After=====calculateFormula()"
//		workbook.save("FullTemplate_PdfService.xlsx");
        for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
            workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
        }

        for (int j = 0; j < workbook.getWorksheets().getCount(); j++) {
            if (shouldExclude(workbook.getWorksheets().get(j).getName())) {
                System.out.println("worksheetName need to EXCLUDE----->>>> " + workbook.getWorksheets().get(j).getName());
                workbook.getWorksheets().get(j).setVisible(false);
            } else {
                System.out.println("worksheetName need to REMOVE EXTRA ROW=======>>> " + workbook.getWorksheets().get(j).getName());
                removeBlankRowsAndColumns(workbook.getWorksheets().get(j));
                removeBlankColumns(workbook.getWorksheets().get(j));
            }
        }

        //Perform fomula calculation
//		workbook.calculateFormula();

        workbook.save("PDF_Result_file22.pdf");

        int worksheetCount = workbook.getWorksheets().getCount();
        int count = 0;
        for (int i = 0; i < worksheetCount; i++) {
            String worksheetName = workbook.getWorksheets().get(i).getName();
            System.out.println("worksheetName = " + worksheetName);
            if (worksheetName.startsWith("_")) {
                System.out.println(count++);
            }
        }
    }

Could you please look into this from your side.

@brpokharel,

Thanks for the template file.

After an initial test, I am able to reproduce the issue as you mentioned by using the following sample code. I found the process is stuck on Workbook.calculateFormula() method. I have to manually close the process after a while:
e.g
Sample code:

FileInputStream io = new FileInputStream(new File("f:\\files\\sampleTemplate.xlsx"));

        Workbook workbook = new Workbook(io);
        workbook.calculateFormula();//halts on this line.

I have logged a ticket with an id “CELLSJAVA-43335” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@Amjad_Sahi

Thank you for quick response and reproducing the issue. We hope it will be fixed soon.

@brpokharel,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@Amjad_Sahi,

It is good news for us. Thank you for this quick fix. Can you provide the approximate time to release a new aspose-cell version with this fix?

@brpokharel,

The fix will be posted within the next few days (2-5 days or so) here. Our next official release (which includes your fix) will be published (on Downloads section/ maven repos.) in the third week of November, 2020.

@brpokharel,

Please try our latest version/fix: Aspose.Cells for Java v20.10.8 (attached)
aspose-cells-20.10.8-java.zip (7.2 MB)

Your issue should be fixed in it.

Let us know your feedback.

@Amjad_Sahi,

It resolved our issue. i.e it is working fine for us. Thanks again for quick response and fixes. We are waiting for your official release. Please let us know when you officially released aspose-cell including this fix.

@brpokharel,

Good to know that your issue is resolved by the new fix. You may use this fix which is fully tested, it will behave like an official release. Also, once the new official release is published, you will get notification in the thread.

The issues you have found earlier (filed as CELLSJAVA-43335) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

Hello,

After updating the aspose cell version to the latest i.e 20.11. We faced a few issues as follows:

  1. We have a few reports that use quadrant charts, horizontal bar graph and vertical bar graph . While exporting such reports, the chart labels are not properly labeled.(Refer to the output folder in the resources)
    2.While exporting reports with bar graphs, some bars of the graph is missing in the exported report.

These issues are not replicated when exported from aspose version 19.5.Please refer to the attached resources which contains necessary code to replicate this issue to further analyze this from your end.

TemplateTest.zip (1.4 MB)

Thanks.

@aasthapa,
This looks like some problem with your input file because microsoft excel 2016 is neither showing the charts. See attached screenshot as an example. MissingChart.PNG (31.2 KB)

PDF file exported with 19.5 version is also attached where I can not find the charts either.
coverageCode19.5.pdf (83.1 KB)

Also share your simplified code here for our analysis, instead of complete project files.

I could not access the attached resources by you. The template does not seem to have any issue as when exported to pdf, the output does have charts. I could replicate the issue with the following code as well.

Please refer to the following sample code.

 FileInputStream io = new FileInputStream(new File("/home/asthapa/Pa-front/project/exportCheck/ReportTemplates/doubleBoldInWord.xlsx"));

    Workbook workbook = new Workbook(io);
    workbook.calculateFormula();
    for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
        workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
    }
   //Removes excess blank page. Can be replicated without the following loop code.
    for (int j = 0; j < workbook.getWorksheets().getCount(); j++) {
        if (shouldExclude(workbook.getWorksheets().get(j).getName())) {
            workbook.getWorksheets().get(j).setVisible(false);
        } else {
            removeBlankRowsAndColumns(workbook.getWorksheets().get(j));
        }
    }
    workbook.save("output.pdf");

Thanks,
Astha

@aasthapa,
Thank you for providing more information. We will analyze it along with the template files provided earlier and share our feedback soon.

@aasthapa,
We have observed issues in the following files using Aspose.Cells for Java 20.12:

SameLabelInBarGraph.xlsx
sameLabelInchart.xlsx
sameLabelInhorizontalBarGraph.xlsx
SameLabelInQuadrantChart.xlsx 

We have logged this issue in our database for further investigation and will write back here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43374 - Chart labels repeated while converting the attached Excel files to PDF

We could not observe any issue with “missingBarGraph.xlsx” file. Could you please share more details with us. Following output file is created with the latest version.
missingBarGraph.pdf.zip (117.1 KB)

Thank you for logging in these issues in your system and I am truly sorry for the late reply. Is there any update for those?

I could not access the pdf file you attached. This issue does not replicate at all when used aspose version cell 19.5. You can see the difference in the pdf attached. But is replicating when used 20.11.

Generated with aspose cell 19.5: noIssue.pdf (78.3 KB)
Generated with aspose cell 20.11: issue.pdf (77.0 KB)

Also, when you say ‘latest version’, do you mean 20.11?

@aasthapa,

Since you are not the owner of the thread, so you might not access the attachments. I have uploaded the output PDF (by Aspose.Cells 20.12) to Google drive and you may get it here

We meant Aspose.Cells 20.12 or 20.1.x.

A post was split to a new topic: One of the bars of the graph is missing while converting XLSX file to PDF

@ahsaniqbalsidiqui

Hello,
Is there any update on the issue (CELLSJAVA-43374 - Chart labels repeated while converting the attached Excel files to PDF) ?

@aasthapa,

I am afraid, your issue is not resolved yet. We will try to figure it out soon. We will also check if we could provide an update/ETA on it if resolution will take more time.