Bug 120651 - konqueror hangs printing a HTML page and uses a lot of memory
Summary: konqueror hangs printing a HTML page and uses a lot of memory
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Unclassified
Component: khtml printing (show other bugs)
Version: 3.5
Platform: openSUSE RPMs Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Allan Sandfeld
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-23 13:04 UTC by Roman Fietze
Modified: 2007-01-07 19:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Fietze 2006-01-23 13:04:42 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs

When printing

  http://de.selfhtml.org/navigation/html.htm

on my box konqueror hangs, eats up all available CPU and increases its memory usage more and more (killed it at about 1GiB).

Printing a similar page

  http://de.selfhtml.org/navigation/css.htm

works without any problem.
Comment 1 Roman Fietze 2006-01-23 13:07:29 UTC
I just recognized that the version is unspecified on the bug's page, allthough I clicked 3.5.0 in the bug wizard.

Because I can't change it, here it is:

  3.5 using KDE 3.5.0 Level "a"
Comment 2 Tommi Tervo 2006-01-23 13:24:46 UTC
Similar to this one, but I've Allans patch so it's a bit different bug. http://bugs.kde.org/show_bug.cgi?id=116861
Comment 3 Roman Fietze 2006-11-04 12:27:00 UTC
Got a segmentation fault when I tried to print that page to a Potscript File. The results where:

(gdb) where
#0  0xb5fb1ca2 in khtml::RenderTableCell::collapsedRightBorder () from /opt/kde3/lib/libkhtml.so.4
#1  0xb5fb2006 in khtml::RenderTableCell::borderRight () from /opt/kde3/lib/libkhtml.so.4
#2  0xb5f8179e in khtml::RenderBlock::rightOffset () from /opt/kde3/lib/libkhtml.so.4
#3  0xb5f9e558 in khtml::RenderBlock::lineWidth () from /opt/kde3/lib/libkhtml.so.4
#4  0xb5fd77d6 in khtml::RenderBlock::findNextLineBreak () from /opt/kde3/lib/libkhtml.so.4
#5  0xb5fdaa59 in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#6  0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#7  0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#8  0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#9  0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#10 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#11 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#12 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#13 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#14 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#15 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
#16 0xb5fdb1ed in khtml::RenderBlock::layoutInlineChildren () from /opt/kde3/lib/libkhtml.so.4
...

and so on forever. Probably that's the reason why I don't get the usual [ck]rash handler window. :)
Comment 4 Kurt Pfeifle 2007-01-07 15:53:33 UTC
Confirmed. Bug still present in KDE 3.5.5 (openSUSE build service RPMs for SUSE 10.0).

More info: it suffice to choose "Print to file (PDF)". You'll notice how in "top" then Konqui's memory consumption starts to continually increase and never stop. Clicking "Cancel" on the "Print Status" progress dialog kills that dialog, but Konqui still hangs, and top still shows that memory usage increases. You need to kill the PID to get out of that, or wait for the segfault to occur...
Comment 5 Kurt Pfeifle 2007-01-07 16:07:11 UTC
Tested with Opera 9.1 and Firefox 1.5.0.9. Both have no problem. Opera creates the print preview (24 pages) in an instant (less than 1 second), Firefox similar.

Printing to a PS file works for both without a hickup.
Comment 6 Kurt Pfeifle 2007-01-07 16:21:55 UTC
The online HTML-->PDF converter at http://www.easysw.com/htmldoc/pdf-o-matic.php is also able to convert this page to PDF without a problem. 

Also, the page validates completely: http://validator.w3.org/check?uri=http%3A%2F%2Fde.selfhtml.org%2Fnavigation%2Fhtml.htm


Which means the bug is probably in KHTML rather than somewhere else  :-)
Comment 7 Allan Sandfeld 2007-01-07 19:19:59 UTC
SVN commit 620910 by carewolf:

Give up trying to make a nice break, when a table makes one impossible.
BUG: 120651


 M  +9 -8      bidi.cpp  
 M  +1 -1      render_table.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/bidi.cpp #620909:620910
@@ -1579,13 +1579,14 @@
             kdDebug( 6040 ) << "Widows: " << widows << endl;
             // Check if we have enough orphans after respecting widows count
             int newOrphans = orphans - (style()->widows() - widows);
-            if (newOrphans < style()->orphans() && parent()->canClear(this,PageBreakHarder))
-            {
-                // Relayout to remove incorrect page-break
-                setNeedsPageClear(true);
-                setContainsPageBreak(false);
-                layoutInlineChildren(relayoutChildren, -1);
-                return;
+            if (newOrphans < style()->orphans()) {
+                if (parent()->canClear(this,PageBreakHarder)) {
+                    // Relayout to remove incorrect page-break
+                    setNeedsPageClear(true);
+                    setContainsPageBreak(false);
+                    layoutInlineChildren(relayoutChildren, -1);
+                    return;
+                }
             } else {
                 // Set hint and try again
                 layoutInlineChildren(relayoutChildren, newOrphans+1);
@@ -1903,7 +1904,7 @@
 #endif
                 if (ignoringSpaces) {
                     // We need to stop ignoring spaces, if we encounter a non-space or
-                    // a run that doesn't collapse spaces
+                    // a run that doesn't collapse spaces.
                     if (!currentCharacterIsSpace || preserveWS) {
                         // Stop ignoring spaces and begin at this
                         // new point.
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_table.cpp #620909:620910
@@ -1825,7 +1825,7 @@
                 RenderTableCell *cell = cellAt(r, c);
                 if (!cell || cell == (RenderTableCell *)-1 )
                     continue;
-                if ( r < totalRows - 1 && cell == cellAt(r+1, c) )
+                if ( r > 0 && cell == cellAt(r-1, c) )
                     continue;
 
                 if ( ( rindx = r-cell->rowSpan()+1 ) < 0 )