Skip to content

rendering a w3cdom document : infinite loop creation of TableCellBox #466

Closed
@AlexisCothenet

Description

@AlexisCothenet

Hello,

I found an OOM but cannot understand the reason. It seems there is a cascade of TableCellBox created using this html (i tried to keep it small but i seems the number of td inside the first tr is mandatory and the 2 others tr as well...) :

String bodyhtml=
                "<table style=\"border-collapse:separate;border:none;padding:0;margin:0;table-layout:fixed;width:711px\" width=\"711\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                        "<tbody>\n" +
                        "<tr style=\"height:1px\">"+
                        "<td style=\"border:none;padding:0\" width=\"91\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"45\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"1\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"1\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"75\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"20\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"52\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"17\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"55\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"17\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"74\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"15\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"2\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"74\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"17\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"21\"></td>"+
                        "<td style=\"border:none;padding:0\" width=\"87\"></td>"+
                        "</tr>" +
                        "<tr style=\"height:4px\">" +
                        "<td style=\"font-style:normal;font-family:Arial;font-size:1px;color:#000000;background-color:#ffffff;text-align:Left;vertical-align:Top;word-wrap:break-word;overflow:hidden;border-collapse:separate;border:none;padding-left:2px;padding-right:2px;padding-top:1px;padding-bottom:1px\" colspan=\"2\" rowspan=\"2\"> </td>" +
                        "</tr>" +
                        "<tr style=\"height:34px\">" +
                        "<td style=\"font-style:normal;font-family:Arial;font-size:1px;color:#000000;background-color:#ffffff;text-align:Left;vertical-align:Top;word-wrap:break-word;overflow:hidden;border-collapse:separate;border:none;padding-left:2px;padding-right:2px;padding-top:1px;padding-bottom:1px\"> </td>" +
                        "</tr>" +
                        "</tbody></table>";
Document doc = Jsoup.parse(htmContent);
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFastMode();
builder.withW3cDocument(new W3CDom().fromJsoup(doc), "");
builder.toStream(outStream);
builder.run();

The version of htmltopdf used is 1.0.2 (jsoup 1.13.1).

Here is the snapshot of the profiler heap dump analysis.
OOM_htmltopdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions