Bug 116861

Summary: konqueror consumes all memory when printing specific web page
Product: [Applications] konqueror Reporter: mathpup
Component: khtml printingAssignee: Allan Sandfeld <kde>
Status: RESOLVED FIXED    
Severity: crash CC: andihartmann, avs, chatnick-spirou, glaurent, johann-nikolaus, krieger, rjwysocki, sts, thorsten.schnebeck
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description mathpup 2005-11-22 09:56:25 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          GCC 3.3.5 

After loading the website http://www.robertluttman.com/flowcharts.html attempting to print results in Konqueror's quickly consuming all available memory and rendering the system unresponsive due to trashing the system's swap.
Comment 1 Tommi Tervo 2005-11-22 10:43:02 UTC
SVN -r 460545 crashes (3.5rc1 too). 
khtml (render): Widows: 1
khtml (render): Widows: 1
khtml (render): Widows: 1

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208084096 (LWP 20859)]
0x087b5e9f in _int_malloc () from /lib/tls/libc.so.6
(gdb) bt
#0  0x087b5e9f in _int_malloc () from /lib/tls/libc.so.6
#1  0x087b7f01 in malloc () from /lib/tls/libc.so.6
#2  0x00d23357 in operator new () from /usr/lib/libstdc++.so.6
#3  0x0560ac0e in QGArray::newData () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#4  0x0560ad2b in QGArray::QGArray$base ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#5  0x055fd4fe in QCString::QCString () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#6  0x002fdece in KEntry (this=0xbf4001b0) at ../../kdecore/kconfigdata.h:36
#7  0x00f85816 in KConfig::lookupData (this=0x8dfec18, _key=@0xbf4001c0)
    at kconfig.cpp:250
#8  0x00f7e3a3 in KConfigBase::readEntryUtf8 (this=0x8dfec18,
    pKey=0x92e3200 "InfoOutput") at kconfigbase.cpp:324
#9  0x00f7f740 in KConfigBase::readNumEntry (this=0x8dfec18,
    pKey=0x92e3200 "InfoOutput", nDefault=2) at kconfigbase.cpp:586
#10 0x00f7f6fc in KConfigBase::readNumEntry (this=0x8dfec18, pKey=@0xbf401300,
    nDefault=2) at kconfigbase.cpp:581
#11 0x00f6ebd3 in kDebugBackend (nLevel=0, nArea=6040,
    data=0x92e3188 "Widows: 1\n") at kdebug.cpp:241
#12 0x00f6f418 in kdbgstream::flush (this=0xbf4014c0) at kdebug.cpp:336
#13 0x009abd87 in kdbgstream::operator<< (this=0xbf4014c0,
    string=0x9cef29 "\n") at /opt/kde35b1/include/kdebug.h:232
#14 0x009abdc1 in endl (s=@0xbf4014c0) at /opt/kde35b1/include/kdebug.h:430
#15 0x009abbfe in kdbgstream::operator<< (this=0xbf4014c0,
    f=0x9abd9c <endl(kdbgstream&)>) at /opt/kde35b1/include/kdebug.h:260
#16 0x05c7e471 in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1559
#17 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
#18 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
#19 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
#20 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
#21 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
#22 0x05c7e54d in khtml::RenderBlock::layoutInlineChildren (this=0x92354ec,
    relayoutChildren=true, breakBeforeLine=0) at bidi.cpp:1571
Comment 2 Maksim Orlovich 2005-11-22 16:55:18 UTC
It runs out of stack space here, dumping out "Widows:1"... Reporter: I guess you don't have any ulimit on stack size?
Comment 3 Maksim Orlovich 2005-11-22 17:14:55 UTC
*** Bug 116881 has been marked as a duplicate of this bug. ***
Comment 4 mathpup 2005-11-23 06:08:41 UTC
I did not have any ulimit set. When I do restrict the process virtual memory size, I get a segfault. So I think that the same thing is happening. It's just that in your system it terminated after running out of stack space, whereas on mine it just kept consuming system memory.
Comment 5 Maksim Orlovich 2005-11-23 15:02:07 UTC
*** Bug 116949 has been marked as a duplicate of this bug. ***
Comment 6 Tommi Tervo 2005-12-12 10:46:16 UTC
*** Bug 87008 has been marked as a duplicate of this bug. ***
Comment 7 Tommi Tervo 2005-12-13 09:37:31 UTC
*** Bug 118198 has been marked as a duplicate of this bug. ***
Comment 8 Tommi Tervo 2005-12-19 13:50:27 UTC
*** Bug 118630 has been marked as a duplicate of this bug. ***
Comment 9 Thiago Macieira 2005-12-26 16:43:23 UTC
*** Bug 119016 has been marked as a duplicate of this bug. ***
Comment 10 Maksim Orlovich 2006-01-05 16:46:29 UTC
*** Bug 119551 has been marked as a duplicate of this bug. ***
Comment 11 Martin Pärtel 2006-01-08 12:39:03 UTC
Here's another case. This one's a very simple page.
http://llvm.cs.uiuc.edu/docs/Stacker.html

I was able to print two very similar documents from the same documentation set even though they were longer.
Comment 12 Hans Ecke 2006-01-12 01:23:06 UTC
Same problem occurs on

http://www.rtd-denver.com/Routes/Route16/016Weekdays.html

(kde 3.5.0 on i386 centos 3.6)
Comment 13 Allan Sandfeld 2006-01-13 12:32:09 UTC
SVN commit 497616 by carewolf:

Don't attempt to break before the first line in a text-run
BUG:116861


 M  +7 -2      bidi.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/bidi.cpp #497615:497616
@@ -834,7 +834,11 @@
             box = box->prevLineBox();
         }
 
-        if (orphans < style()->orphans()) {
+        if (orphans == 0) {
+            setNeedsPageClear(true);
+            doPageBreak = false;
+        } else
+        if (orphans < style()->orphans() ) {
 #ifdef PAGE_DEBUG
             kdDebug(6040) << "Orphans: " << orphans << endl;
 #endif
@@ -1555,7 +1559,8 @@
                 widows++;
             lineBox = lineBox->nextLineBox();
         }
-        if (widows < style()->widows()) {
+        // Widows rule broken and more orphans left to use
+        if (widows < style()->widows() && orphans > 0) {
             kdDebug( 6040 ) << "Widows: " << widows << endl;
             // Check if we have enough orphans after respecting widows count
             int newOrphans = orphans - (style()->widows() - widows);
Comment 14 Tommi Tervo 2006-01-17 09:46:44 UTC
*** Bug 120230 has been marked as a duplicate of this bug. ***
Comment 15 Tommi Tervo 2006-01-27 18:52:09 UTC
*** Bug 120879 has been marked as a duplicate of this bug. ***