Bug 138521 - SIGSEGV crash after saving history twice
Summary: SIGSEGV crash after saving history twice
Alias: None
Product: konsole
Classification: Unclassified
Component: general (show other bugs)
Version: 1.6.4
Platform: Slackware Packages Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Konsole Developer
Depends on:
Reported: 2006-12-08 02:16 UTC by Grant W Quinlan
Modified: 2006-12-11 16:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Grant W Quinlan 2006-12-08 02:16:22 UTC
Version:           1.6.4 (using KDE KDE 3.5.4)
Installed from:    Slackware Packages
Compiler:          gcc (GCC) 3.4.6 
OS:                Linux

Konsole crashes on alternate save attempts when I set history to >2000 lines and then I try save history to a file. 

I am using Konsole 1.6.4 with KDE 3.5.4 on Slackware 11.0.

When I scan the bug history I see that this behaviour is similar to Bug 85779: History Size set to Unlimited with > 50.000 lines causes Konsole to crash when you try to save the history. That bug was fixed 2.5 years ago in Konsole 1.3.2. It is also similar to Bug 111604 which was apparently fixed in Konsole 1.4.2 so I believe that this may be something new.

Here is how I can reliably reproduce this failure:
> I am trying to capture the output of a failing "make" for a project I am working on, that produces about 2800 lines of text. 
> The failure occurs when I am using just one session or when I am using multiple sessions in my Konsole window.
> Set the session to record >2000 lines (I am trying to capture 3000 lines) (Konsole Menu->Settings->History, Enable checked, Number of lines: 3000)
> Clear the session histories before starting (Konsole Menu->Edit->Clear All Histories)
> Generate a little more than 2000 lines of output (my "make" works, but so does "cat"ing a big text file) 
> Save the session history to a file (Konsole Menu->Edit->Save History As ...->{Enter a name}->Save->Overwrite)
> Clear the session histories again
> Generate a lot of output again
> Save the session history to a file (Konsole Menu->Edit->Save History As ...->{Enter a name}->Save->Overwrite)
> The Konsole application then crashes

If I do not clear the session history then the crash does not occur reliably.

After the crash the Konsole windows disappear and the KDE crash handler takes over reporting a signal 11 SIGSEGV error. 
Here is the KDE backtrace report:
(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(no debugging symbols found)
...(repeated 18 times)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1232058688 (LWP 9244)]
[KCrash handler]
#5  0xb67f76b7 in TESession::getEmulation ()
   from /opt/kde/lib/libkdeinit_konsole.so
#6  0xb67ef6b1 in Konsole::qt_invoke ()
   from /opt/kde/lib/libkdeinit_konsole.so
#7  0xb7137d44 in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#8  0xb71384dc in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#9  0xb7a2a429 in KAction::activated () from /opt/kde/lib/libkdeui.so.4
#10 0xb7a2ae8a in KAction::slotActivated () from /opt/kde/lib/libkdeui.so.4
#11 0xb7a2f719 in KAction::slotPopupActivated ()
   from /opt/kde/lib/libkdeui.so.4
#12 0xb7a2f925 in KAction::qt_invoke () from /opt/kde/lib/libkdeui.so.4
#13 0xb7137d44 in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xb74778ed in QSignal::signal () from /usr/lib/qt/lib/libqt-mt.so.3
#15 0xb71527a1 in QSignal::activate () from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xb724aa27 in QPopupMenu::mouseReleaseEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xb7a1a1a1 in KPopupMenu::mouseReleaseEvent ()
   from /opt/kde/lib/libkdeui.so.4
#18 0xb7171aa4 in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xb70d323f in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#20 0xb70d3496 in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#21 0xb773aac5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#22 0xb706d60a in QETWidget::translateMouseEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#23 0xb706b821 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#24 0xb707ef25 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#25 0xb70e9961 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#26 0xb70e98b6 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#27 0xb70d239f in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#28 0xb67cb87f in kdemain () from /opt/kde/lib/libkdeinit_konsole.so
#29 0xb763c7d4 in kdeinitmain () from /opt/kde/lib/kde3/konsole.so
#30 0x0804e4b4 in ?? ()
#31 0x00000002 in ?? ()
#32 0x08083f60 in ?? ()
#33 0x00000001 in ?? ()
#34 0x00000000 in ?? ()
Comment 1 Philip Rodrigues 2006-12-08 15:02:38 UTC
Confirmed on r607234. Different backtrace though (this seems to make more sense though):

#19 0x2984c765 in Konsole::slotSaveHistory (this=0x815b840)
    at /home/phil/kdesrc/kdebase/konsole/konsole/konsole.cpp:4060
#20 0x2984f0c7 in Konsole::qt_invoke (this=0x815b840, _id=134, _o=0xbfbfd860)
    at konsole.moc:499
#21 0x28e181e0 in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#22 0x28e18851 in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#23 0x28598582 in KAction::activated (this=0x81adc28) at kaction.moc:176
#24 0x28597ba9 in KAction::slotActivated (this=0x81adc28)
    at /home/phil/kdesrc/kdelibs/kdeui/kaction.cpp:1102
#25 0x28597d9e in KAction::slotPopupActivated (this=0x81adc28)
    at /home/phil/kdesrc/kdelibs/kdeui/kaction.cpp:1129
#26 0x285989ce in KAction::qt_invoke (this=0x81adc28, _id=16, _o=0xbfbfd9f0)
    at kaction.moc:219
Comment 2 Robert Knight 2006-12-10 01:37:56 UTC
Fixed by SVN commit #611528.  Cause was use of the wrong variable to access the current session when saving history.
Comment 3 Grant W Quinlan 2006-12-11 02:27:28 UTC
Thanks for looking into and fixing this Robert! You guys are awesome!

Will source for this fix show up at ftp.kde.org/.../unstable so that I update my copy of the app? If so how long does it usually take? If not then how and when can I get the fix onto my system? 

             Grant Q
Comment 4 Robert Knight 2006-12-11 16:12:51 UTC
Hello Grant,

The fix will be part of the next KDE 3.5.x release ( ie. 3.5.6 ).  I am not sure when that will be released though.

A copy of the Konsole library with the fix can be found here: http://www.robertknight.me.uk/files/kde/konsole-138521-fix.tar.gz

1.  Close any open Konsole windows.  
2.  Extract the contents of the archive into your system's library folder ( /usr/lib ) - but don't do the extraction from a Konsole terminal.
3.  Restart Konsole, go to 'Help > About Konsole' and it should give the version number as 1.6.6

This binary was compiled under Kubuntu, it may not work with your distro.

The proper way to get this fix into your distro would be to get in touch with the maintainer of Konsole and ask them to apply a two-line patch to the konsole package - http://www.robertknight.me.uk/files/kde/138452-fix.patch ( but please test that the fix works on your machine first! )