Bug 99772

Summary: complete hang (endless loop?) when editing certain entries
Product: [Unmaintained] kdelibs Reporter: Stephan Johach <lucardus>
Component: kspellAssignee: Zack Rusin <zack>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Stephan Johach 2005-02-19 12:40:41 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.3 
OS:                Linux

I have several files in the german translation for KDE 3.4 which
bring kbabel and the whole desktop to a hang when editing them.

This is very critical for me as I am not able to do anything on
the machine other than press the reset button of my computer.

It looks like kbabel is running in an endless loop catching all
the cpu cycles. Mouse is hopping from time to time if moved. But
no reaction on keystrokes. No ctr-alt-del possible.

How to reproduce:

Open the german kdelibs.po (cvs revision 1.409 from HEAD) and try
to edit the fuzzy or untranslated entries. I can not remember on 
which entry it exactly crashes but i does every time I try.

I remember the crashes always happen if there are many tags or
special characters.

I searched with a text editor, and I think the following entry
triggers the last crash I had:


#: kutils/kfinddialog.cpp:256
msgid ""
"<qt>If enabled, any occurrence of <code><b>\\N</b></code>, where "
"<code><b>N</b></code> is a integer number, will be replaced with the "
"corresponding capture (\"parenthesized substring\") from the pattern."
"<p>To include (a literal <code><b>\\N</b></code>"
" in your replacement, put an extra backslash in front of it, like "
"<code><b>\\\\N</b></code>.</qt>"
msgstr ""

It happend while editing. But I had other entries leading to a complete hang simply by opening them.
Comment 1 Stanislav Visnovsky 2005-02-22 21:20:43 UTC
This looks like kdelibs/kspell problem (endless recursion):

excerpt from bt:
#0  0x40e6abf5 in QCString::find () from /usr/lib/qt3/lib/libqt-mt.so.3
#1  0x407c43cd in KProcIO::readln () from /opt/kde3/lib/libkdecore.so.4
#2  0x405ddd15 in KSpell::check2 () from /opt/kde3/lib/libkdeui.so.4
#3  0x405e65ce in KSpell::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#4  0x40bb703a in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#5  0x40795812 in KProcIO::readReady () from /opt/kde3/lib/libkdecore.so.4
#6  0x407958da in KProcIO::controlledEmission ()
   from /opt/kde3/lib/libkdecore.so.4
#7  0x4079592d in KProcIO::ackRead () from /opt/kde3/lib/libkdecore.so.4
#8  0x405ddeab in KSpell::check2 () from /opt/kde3/lib/libkdeui.so.4
#9  0x405e65ce in KSpell::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#10 0x40bb703a in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#11 0x40795812 in KProcIO::readReady () from /opt/kde3/lib/libkdecore.so.4
#12 0x407958da in KProcIO::controlledEmission ()
   from /opt/kde3/lib/libkdecore.so.4
#13 0x4079592d in KProcIO::ackRead () from /opt/kde3/lib/libkdecore.so.4
#14 0x405ddeab in KSpell::check2 () from /opt/kde3/lib/libkdeui.so.4
#15 0x405e65ce in KSpell::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#16 0x40bb703a in QObject::activate_signal ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/qt3/lib/libqt-mt.so.3
#17 0x40795812 in KProcIO::readReady () from /opt/kde3/lib/libkdecore.so.4
#18 0x407958da in KProcIO::controlledEmission ()
   from /opt/kde3/lib/libkdecore.so.4
#19 0x4079592d in KProcIO::ackRead () from /opt/kde3/lib/libkdecore.so.4
#20 0x405ddeab in KSpell::check2 () from /opt/kde3/lib/libkdeui.so.4
#21 0x405e65ce in KSpell::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#22 0x40bb703a in QObject::activate_signal ()


KBabel uses KSpell object for spell-as-you-go.
Comment 2 Stephan Johach 2005-02-23 17:37:32 UTC
I disabled the on the fly spellchecking and it works until now. No hang
the last two days.

Some additional data:

hunsum@leviathan:~$ aspell --version
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.2)
hunsum@leviathan:~$

I am working with a german dictionary.
Comment 3 Waldo Bastian 2005-03-15 10:54:00 UTC
CVS commit by waba: 

Fix recursion problem (SUSE BR72773)
BUG: 99772


  M +7 -3      kspell.cpp   1.133


--- kdelibs/kdeui/kspell.cpp  #1.132:1.133
@@ -1095,12 +1095,16 @@ void KSpell::check2( KProcIO * )
   } while( tempe>0 );
 
-  proc->ackRead();
-
-
   if ( tempe == -1 ) { //we were called, but no data seems to be ready...
+    // Make sure we don't get called directly again and make sure we do get
+    // called when new data arrives.
+    NOOUTPUT( check2 );
+    proc->enableReadSignals(true);
+    OUTPUT( check2 );
     recursive = false;
     return;
   }
 
+  proc->ackRead();
+
   //If there is more to check, then send another line to ISpell.
   if ( (unsigned int)lastline < origbuffer.length() )