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
    <br /> <SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN><br />

    In context of a very simple example:
    <br /> <table><br /> <tr><br /> <td><br /> TEXT<br /> <!--<SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN>--><br /> MORE TEXT<br /> <SPAN style="white-space:pre" class="Apple-tab-span"> </SPAN><br /> FINAL TEXT<br /> </td><br /> </tr><br /> </table><br />

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

    And the following is a very short Java program to demonstrate the issue:
    <br /> 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>";<br /> StringReader sr = new StringReader(html);<br /> OutputStream os = new ByteArrayOutputStream();<br /> <br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.enableDebugInfo();<br /> pd4ml.useTTF( "java:", true );<br /> pd4ml.setHtmlWidth(1050);<br /> pd4ml.enableSmartTableBreaks(true);<br /> <br /> try {<br /> pd4ml.render(sr, os);<br /> } catch (Exception e) { }<br /> <br /> sop(((ByteArrayOutputStream)os).toByteArray());<br />

    #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.