Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26779

    When an certain snippet of HTML exists in a document, it will make the renderer enter some kind of death spiral where it will fill up the heap until the machine stops responding.

    The snippet seems to be

    <SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>

    In context of a very simple example:

    <table>
    <tr>
    <td>
    TEXT
    <!--<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>-->
    MORE TEXT
    <SPAN style="white-space:pre" class="Apple-tab-span">   </SPAN>
    FINAL TEXT
    </td>
    </tr>
    </table>

    Here’s a histogram of my heap after trying to render this HTML:

    num     #instances         #bytes  class name
    <hr class="bbcode_rule" />
    1:      12253005      784192320  org.zefer.html.doc.view.b
    2:           517       55412344  [Ljava.lang.Object;
    3:         26309        3785624  <constMethodKlass>
    4:         26309        3590760  <methodKlass>
    5:          2671        2474760  [B
    6:          1786        2400848  <constantPoolKlass>
    7:          1786        1494536  <instanceKlassKlass>
    8:          1504        1396576  <constantPoolCacheKlass>
    9:         18028        1279584  [C
    10:          8536         603344  [I
    11:         18388         588416  java.lang.String
    12:         12400         396800  java.util.HashMap$Entry
    13:           457         321504  <methodDataKlass>
    14:          1966         242192  java.lang.Class
    15:          2781         204224  [S
    16:          2765         173064  [[I
    17:          6991         111856  java.lang.Integer
    18:           304         108560  [Ljava.util.HashMap$Entry;
    19:           163          95192  <objArrayKlassKlass>
    20:          1761          56352  java.util.concurrent.ConcurrentHashMap$HashEntry

    And the following is a very short Java program to demonstrate the issue:

    String html = "<table><tr><td>TEXT<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>MORE TEXT<SPAN style="white-space:pre" class="Apple-tab-span">   </SPAN>FINAL TEXT</td></tr></table>";
    StringReader sr = new StringReader(html);
    OutputStream os = new ByteArrayOutputStream();
    
    PD4ML pd4ml = new PD4ML();
    pd4ml.enableDebugInfo();
    pd4ml.useTTF( "java:", true );
    pd4ml.setHtmlWidth(1050);
    pd4ml.enableSmartTableBreaks(true);
    
    try {
    pd4ml.render(sr, os);
    } catch (Exception e) { }
    
    sop(((ByteArrayOutputStream)os).toByteArray());

    #29116

    We reproduced the problem and work on it.

    #29117

    The problem is fixed in the development build. To be released in 2-3 days.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.