Bug 123315 - kwrite/kate crashes randomly after save
Summary: kwrite/kate crashes randomly after save
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Dirk Mueller
URL:
Keywords:
: 118661 118721 120999 127295 128569 128638 129810 130756 133064 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-09 04:18 UTC by Thanos Leontaris
Modified: 2006-08-27 15:44 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Remove deleted subentries from parent entries in KDirWatch (1.53 KB, patch)
2006-06-11 11:56 UTC, Hamish Rodda
Details
Slightly modified version of Hamish Rodda's patch (2.06 KB, patch)
2006-06-12 13:42 UTC, Tais P. Hansen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thanos Leontaris 2006-03-09 04:18:34 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources
Compiler:          gcc-3.4.5 gentoo glibc-2.3.5-r2 gentoo
OS:                Linux

Going from KDE 3.5.0 to KDE 3.5.1 in gentoo unstable (~x86) makes kwrite/kate unusable since they crash randomly when saving. In one instance I lost data and recovered it through the ~ backup.

Keeping all packages to 3.5.1 and reverting kdebase, kdelibs and arts to 3.5.0 solves this problem. When kwrite/kate are run through a console I get something about "/etc/exports" and kio_slave not able to write/find (?)

In addition I use SCIM/SKIM-1.4.4 and anthy as input method for japanese/chinese.

In essence, it is a showstopper bug, since 3.5.1 is not safe as a production environment.
Comment 1 Dominik Haumann 2006-03-31 18:20:33 UTC
We need a backtrace, or detailed information about how to reproduce. Otherwise this report does not help at all (and thus is invalid) :(
Comment 2 Thanos Leontaris 2006-04-01 01:55:13 UTC
I am now running KDE 3.5.2 with qt 3.3.6 and glibc 2.3.5-r2 all with gentoo ebuilds and gcc 3.4.5 compiler. KDE and qt were compiled with "-fPIC -march=pentium-m -fomit-frame-pointer -O3".

Are the above versions well matched?

Unfortunately since I use the machine for work I cannot compile KDE with debug information. In KDE 3.5.1 the problem was quite bad. In KDE 3.5.2 I only had one crash during saving without losing any data. So I am sticking for the timing being and not downgrading to 3.5.0.
Comment 3 Thanos Leontaris 2006-04-13 20:50:33 UTC
After installing kdelibs-3.5.2-r2 in gentoo the problem seems to have disappeared.
"-r2" applies 5 patches (pasted from the ebuild):

PATCHES="${FILESDIR}/${PN}-3.5.0-bindnow.patch
    ${FILESDIR}/${PN}-3.5.0-kicker-crash.patch
    ${FILESDIR}/${P}-xorg7-rgbtxt.patch
    ${FILESDIR}/kdelibs-3.5.2-kio-errror-handling.diff
    ${FILESDIR}/kdelibs-3.5.2-kate-fixes.diff"

it seems that the first or last two did the trick.
Comment 4 Thanos Leontaris 2006-04-17 19:12:39 UTC
*** glibc detected *** corrupted double-linked list: 0x083ec420 ***
KCrash: Application 'kwrite' crashing...

[2]+  Exit 253                kwrite

kwrite just crashed

still kate hasn't crashed yet...
Comment 5 Dominik Haumann 2006-04-19 09:18:39 UTC
> Going from KDE 3.5.0 to KDE 3.5.1 in gentoo unstable (~x86) makes
> kwrite/kate unusable since they crash randomly when saving. In one instance
> I lost data and recovered it through the ~ backup.

What do you mean by "lost data". Was the saved file truncated, like described in bug #120999 (http://bugs.kde.org/show_bug.cgi?id=120999) ?
Comment 6 Thanos Leontaris 2006-04-19 18:09:27 UTC
Yes it was indeed truncated. The ~ backup saved me in all these cases.
With KDE 3.5.2 only kwrite has crashed so far. Kate seems stable...
FYI I run now kdelibs-3.5.2-r3 and kdebase-3.5.2-r1
Comment 7 Dominik Haumann 2006-04-19 18:44:15 UTC
*** Bug 120999 has been marked as a duplicate of this bug. ***
Comment 8 Christopher J. Bottaro 2006-05-05 01:06:57 UTC
I experience this bug many times a day.  I'm using Fedora Core 4 with the kde-redhat rpms.  The bug just started happening for me after I yum updated to 3.5.2-1.6.fc4.kde (I forgot what version I updated from).  My backtrace is useless (no debug symbols).  This comment is intended to make people more aware of this bug and hopefully someone with debug symbols will give a meaningful backtrace.
Comment 9 Thanos Leontaris 2006-05-05 01:23:16 UTC
For me the situation has changed a bit:
kwrite still crashes, but
kate and kdevelop even after heavy and long use stay rock-solid

Isn't kate and kdevelop supposed to be built on top of the same text editing infrastructure with kwrite?

(using kdelibs-3.5.2-r4 and kdebase-3.5.2-r1 in gentoo)
Comment 10 Dominik Haumann 2006-05-05 13:07:34 UTC
We need a backtrace.
Comment 11 Christopher J. Bottaro 2006-05-10 20:58:33 UTC
Here's a partial backtrace.  The bug consistently happens when I modify a document via another editor (in my case, CVS modifies the file after a commit), reload that document in kate, change the document in kate, then save the document in kate.  I'm using KDE-3.5.2.

(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1208191296 (LWP 11283)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#6  0x05aad7af in operator== () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#7  0x06239398 in KDirWatchPrivate::slotActivated () from /usr/lib/libkio.so.4
#8  0x0623adad in KDirWatchPrivate::qt_invoke () from /usr/lib/libkio.so.4
#9  0x057a4b14 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#10 0x057a513a in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#11 0x05b1e3f6 in QSocketNotifier::activated ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#12 0x057c4435 in QSocketNotifier::event ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#13 0x0573fb8d in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x057404dc in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#15 0x00b9eecd in KApplication::notify () from /usr/lib/libkdecore.so.4
#16 0x05733619 in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#17 0x056e87ea in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x0575820b in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x0573f57f in QApplication::enter_loop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#20 0x061a24fb in KIO::NetAccess::enter_loop () from /usr/lib/libkio.so.4
#21 0x061ffc70 in KIO::NetAccess::filecopyInternal ()
   from /usr/lib/libkio.so.4
#22 0x06215ea7 in KIO::NetAccess::file_copy () from /usr/lib/libkio.so.4
#23 0x00e9c5ec in KateDocument::save () from /usr/lib/kde3/libkatepart.so
#24 0x00e7fbfa in KateView::save () from /usr/lib/kde3/libkatepart.so
#25 0x00f3a016 in KateView::qt_invoke () from /usr/lib/kde3/libkatepart.so
#26 0x057a4b14 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#27 0x057a4fca in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x05e938f7 in KAction::activated () from /usr/lib/libkdeui.so.4
#29 0x05ec96c4 in KAction::slotActivated () from /usr/lib/libkdeui.so.4
#30 0x05ee5099 in KAction::qt_invoke () from /usr/lib/libkdeui.so.4
#31 0x057a4b14 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#32 0x057a4fca in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#33 0x00ae55c5 in KAccelPrivate::menuItemActivated ()
   from /usr/lib/libkdecore.so.4
#34 0x00b1ccfa in KAccelPrivate::emitActivatedSignal ()
   from /usr/lib/libkdecore.so.4
#35 0x00b77aed in KAccelPrivate::eventFilter () from /usr/lib/libkdecore.so.4
#36 0x057a459c in QObject::activate_filters ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#37 0x057a4611 in QObject::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#38 0x057e27f0 in QWidget::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#39 0x058a8860 in QMainWindow::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#40 0x0779dbc4 in KateMainWindow::event ()
   from /usr/lib/libkateinterfaces.so.0
#41 0x0573fb8d in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#42 0x057407e9 in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#43 0x00b9eecd in KApplication::notify () from /usr/lib/libkdecore.so.4
#44 0x00b1cabf in KAccelEventHandler::x11Event ()
   from /usr/lib/libkdecore.so.4
#45 0x00b9d4be in KApplication::x11EventFilter ()
   from /usr/lib/libkdecore.so.4
#46 0x056c6ca1 in qt_set_x11_event_filter ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#47 0x056d3803 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#48 0x056e84b8 in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#49 0x057581f2 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#50 0x05758116 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#51 0x0573f559 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#52 0x006bfdd6 in kdemain () from /usr/lib/libkdeinit_kate.so
#53 0x0044cd7f in __libc_start_main () from /lib/libc.so.6
#54 0x080483e1 in ?? ()
Comment 12 Tais P. Hansen 2006-06-08 10:47:40 UTC
I've been plagued by this bug as well with kde-3.5.2 and now also 3.5.3. It affects Quanta and KDevelop as well, probably because of katepart.

It's really easy to reproduce on my box. (Slackware 10.2, gcc-3.3.6, qt-3.3.4)

Create a file with some content. Ie.

---[snip]---
# Hello world.
# $Id$

echo "Hello wirld!"
---[snip]---

Add it to svn and set svn:keywords:

svn add test.sh
svn propset svn:keywords Id test.sh
svn commit test.sh

Kate will popup a requester saying the file changed; Status on Disk is "Created". Reload the file, and ie. correct the echo-line from "wirld" to "world" and save. Kate crashes with a "Copy File(s) Progress" dialog open, making a backup file. Any changes are lost.

I haven't been able to reproduce this without svn. Manually editing the file or moving it around doesn't seem to affect kate the same way. The "modified files" dialog's Status on Disk field in those cases are "Modified" or "Deleted". It only seems to happen when kate thinks the file was "Created".

Backtrace (using backup files):

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1242974496 (LWP 1465)]
[KCrash handler]
#5  0xb7145d99 in operator== () from /usr/lib/qt/lib/libqt-mt.so.3
#6  0xb7a988e1 in KDirWatchPrivate::slotActivated ()
   from /opt/kde/lib/libkio.so.4
#7  0xb7a9c31f in KDirWatchPrivate::qt_invoke () from /opt/kde/lib/libkio.so.4
#8  0xb6e671ec in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#9  0xb6e6734d in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#10 0xb718af22 in QSocketNotifier::activated ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#11 0xb6e839c0 in QSocketNotifier::event () from /usr/lib/qt/lib/libqt-mt.so.3
#12 0xb6e0a95f in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#13 0xb6e09f5e in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xb74476b5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#15 0xb6dfa36a in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xb6db48b3 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xb6e1cd18 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0xb6e0ac11 in QApplication::enter_loop ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xb7a5cf83 in KIO::NetAccess::enter_loop () from /opt/kde/lib/libkio.so.4
#20 0xb7a5c263 in KIO::NetAccess::filecopyInternal ()
   from /opt/kde/lib/libkio.so.4
#21 0xb7a5a9a0 in KIO::NetAccess::file_copy () from /opt/kde/lib/libkio.so.4
#22 0xb5cc564f in KateDocument::save () from /opt/kde/lib/kde3/libkatepart.so
#23 0xb5d07c11 in KateView::save () from /opt/kde/lib/kde3/libkatepart.so
#24 0xb5cfe1f9 in KateView::qt_invoke () from /opt/kde/lib/kde3/libkatepart.so
#25 0xb6e671ec in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#26 0xb6e67014 in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#27 0xb7739d4b in KAction::activated () from /opt/kde/lib/libkdeui.so.4
#28 0xb77394ba in KAction::slotActivated () from /opt/kde/lib/libkdeui.so.4
#29 0xb773a043 in KAction::qt_invoke () from /opt/kde/lib/libkdeui.so.4
#30 0xb6e671ec in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#31 0xb6e67014 in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#32 0xb74df62b in KAccelPrivate::menuItemActivated ()
   from /opt/kde/lib/libkdecore.so.4
#33 0xb74ddef9 in KAccelPrivate::emitActivatedSignal ()
   from /opt/kde/lib/libkdecore.so.4
#34 0xb74ddc96 in KAccelPrivate::eventFilter ()
   from /opt/kde/lib/libkdecore.so.4
#35 0xb6e64b1e in QObject::activate_filters ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#36 0xb6e64a4c in QObject::event () from /usr/lib/qt/lib/libqt-mt.so.3
#37 0xb6e9d56f in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#38 0xb6f5c132 in QMainWindow::event () from /usr/lib/qt/lib/libqt-mt.so.3
#39 0xb7eaf80c in KateMainWindow::event ()
   from /opt/kde/lib/libkateinterfaces.so.0
#40 0xb6e0a95f in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#41 0xb6e0a454 in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#42 0xb74476b5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#43 0xb74dccab in KAccelEventHandler::x11Event ()
   from /opt/kde/lib/libkdecore.so.4
#44 0xb744d7df in KApplication::x11EventFilter ()
   from /opt/kde/lib/libkdecore.so.4
#45 0xb6d940b8 in qt_set_x11_event_filter ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#46 0xb6d9dd9b in QApplication::x11ProcessEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#47 0xb6db4e54 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#48 0xb6e1cd18 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#49 0xb6e1cbc8 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#50 0xb6e0abb1 in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#51 0xb7f073f8 in kdemain () from /opt/kde/lib/libkdeinit_kate.so
#52 0x0804876b in main ()

Backtrace (without backup files):

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1242880288 (LWP 1527)]
[KCrash handler]
#5  0xb715cd99 in operator== () from /usr/lib/qt/lib/libqt-mt.so.3
#6  0xb7aaf8e1 in KDirWatchPrivate::slotActivated ()
   from /opt/kde/lib/libkio.so.4
#7  0xb7ab331f in KDirWatchPrivate::qt_invoke () from /opt/kde/lib/libkio.so.4
#8  0xb6e7e1ec in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#9  0xb6e7e34d in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#10 0xb71a1f22 in QSocketNotifier::activated ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#11 0xb6e9a9c0 in QSocketNotifier::event () from /usr/lib/qt/lib/libqt-mt.so.3
#12 0xb6e2195f in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#13 0xb6e20f5e in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xb745e6b5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#15 0xb6e1136a in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xb6dcb8b3 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xb6e33d18 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0xb6e33bc8 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xb6e21bb1 in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#20 0xb7f1e3f8 in kdemain () from /opt/kde/lib/libkdeinit_kate.so
#21 0x0804876b in main ()
Comment 13 Tais P. Hansen 2006-06-08 11:01:53 UTC
I just tried something else. Hitting ignore on changed files and using F5 to reload the file allowed me to make multiple change, save, commit passes. But the fifth time or so I tried, Kate crashed as soon as I committed the file in a konsole shell, not showing the usual "modified files" dialog.

Just a thought. I'm using kernel 2.6.16 with both INOTIFY and DNOTIFY enabled in kernel and --enable-inotify (but not dnotify) when compiling kdelibs. I'm not sure if it has anything to do with this issue though.

Backtrace:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1242929440 (LWP 1608)]
[KCrash handler]
#5  0xb7150d99 in operator== () from /usr/lib/qt/lib/libqt-mt.so.3
#6  0xb7aa38e1 in KDirWatchPrivate::slotActivated ()
   from /opt/kde/lib/libkio.so.4
#7  0xb7aa731f in KDirWatchPrivate::qt_invoke () from /opt/kde/lib/libkio.so.4
#8  0xb6e721ec in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#9  0xb6e7234d in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#10 0xb7195f22 in QSocketNotifier::activated ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#11 0xb6e8e9c0 in QSocketNotifier::event () from /usr/lib/qt/lib/libqt-mt.so.3
#12 0xb6e1595f in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#13 0xb6e14f5e in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xb74526b5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#15 0xb6e0536a in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xb6dbf8b3 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xb6e27d18 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0xb6e27bc8 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xb6e15bb1 in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#20 0xb7f123f8 in kdemain () from /opt/kde/lib/libkdeinit_kate.so
#21 0x0804876b in main ()
Comment 14 Hamish Rodda 2006-06-10 12:28:59 UTC
Here's the real story:

==25242== Invalid read of size 8
==25242==    at 0x7736410: operator==(QString const&, QString const&) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x5BB1586: KDirWatchPrivate::slotActivated() (kdirwatch.cpp:439)
==25242==    by 0x5BB176A: KDirWatchPrivate::qt_invoke(int, QUObject*) (kdirwatch_p.moc:90)
==25242==    by 0x74B07AB: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74B13EE: QObject::activate_signal(int, int) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74CB04A: QSocketNotifier::event(QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x7459984: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x745A5B6: QApplication::notify(QObject*, QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x67946E4: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:550)
==25242==    by 0x744F97B: QEventLoop::activateSocketNotifiers() (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x741040F: QEventLoop::processEvents(unsigned) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x746E6A0: QEventLoop::enterLoop() (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x5B79670: KIO::NetAccess::enter_loop() (netaccess.cpp:498)
==25242==    by 0x5B79C5C: KIO::NetAccess::filecopyInternal(KURL const&, KURL const&, int, bool, bool, QWidget*, bool) (netaccess.cpp:316)
==25242==    by 0x5B7A217: KIO::NetAccess::file_copy(KURL const&, KURL const&, int, bool, bool, QWidget*) (netaccess.cpp:127)
==25242==    by 0xA98F920: KateDocument::save() (katedocument.cpp:2464)
==25242==    by 0xA9CB21D: KateView::save() (kateview.cpp:850)
==25242==    by 0x4CC47DD: KateDocManager::saveAll() (katedocmanager.cpp:443)
==25242==    by 0x4CC5A70: KateDocManager::qt_invoke(int, QUObject*) (katedocmanager.moc:151)
==25242==    by 0x74B07AB: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74B14C2: QObject::activate_signal(int) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x60D3201: KAction::activated() (kaction.moc:176)
==25242==    by 0x60D3924: KAction::slotActivated() (kaction.cpp:1102)
==25242==    by 0x60D3EE8: KAction::qt_invoke(int, QUObject*) (kaction.moc:218)
==25242==    by 0x74B07AB: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74B14C2: QObject::activate_signal(int) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x680BB1D: KAccelPrivate::menuItemActivated() (kaccelprivate.moc:110)
==25242==    by 0x680CE6E: KAccelPrivate::emitActivatedSignal(KAccelAction*) (kaccel.cpp:400)
==25242==    by 0x680D4D1: KAccelPrivate::eventFilter(QObject*, QEvent*) (kaccel.cpp:370)
==25242==    by 0x74B01B1: QObject::activate_filters(QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74B0206: QObject::event(QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x74E32C7: QWidget::event(QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==  Address 0x9B5C8D8 is 168 bytes inside a block of size 208 free'd
==25242==    at 0x4A1FFEF: operator delete(void*) (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==25242==    by 0x5BB3AAE: QMapPrivate<QString, KDirWatchPrivate::Entry>::remove(QMapIterator<QString, KDirWatchPrivate::Entry>) (qmap.h:386)
==25242==    by 0x5BB3B36: QMap<QString, KDirWatchPrivate::Entry>::remove(QString const&) (qmap.h:834)
==25242==    by 0x5BAF58F: KDirWatchPrivate::removeEntry(KDirWatch*, QString const&, KDirWatchPrivate::Entry*) (kdirwatch.cpp:973)
==25242==    by 0x5BAF5D4: KDirWatch::removeFile(QString const&) (kdirwatch.cpp:1638)
==25242==    by 0xA98E758: KateDocument::deactivateDirWatch() (katedocument.cpp:2669)
==25242==    by 0xA99B3C9: KateDocument::closeURL() (katedocument.cpp:2701)
==25242==    by 0xA98FCF3: KateDocument::openURL(KURL const&) (katedocument.cpp:2204)
==25242==    by 0xA99044A: KateDocument::reloadFile() (katedocument.cpp:4366)
==25242==    by 0xA98C954: KateDocument::slotModifiedOnDisk(Kate::View*) (katedocument.cpp:4280)
==25242==    by 0xA9A0C68: KateDocument::qt_invoke(int, QUObject*) (katedocument.moc:1156)
==25242==    by 0x74B070F: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0xA9D39A9: KateView::gotFocus(Kate::View*) (kateview.moc:663)
==25242==    by 0xA9F11A6: KateViewInternal::focusInEvent(QFocusEvent*) (kateviewinternal.cpp:2928)
==25242==    by 0x74E359E: QWidget::event(QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x7459984: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x745A5B6: QApplication::notify(QObject*, QEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x67946E4: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:550)
==25242==    by 0x74E30C9: QWidget::setFocus() (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x745DA38: QApplication::setActiveWindow(QWidget*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x7401688: QApplication::x11ProcessEvent(_XEvent*) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x741022E: QEventLoop::processEvents(unsigned) (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x746E6A0: QEventLoop::enterLoop() (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x746E549: QEventLoop::exec() (in /usr/lib/qt3/lib64/libqt-mt.so.3.3.5)
==25242==    by 0x4B2A76C: kdemain (katemain.cpp:253)
==25242==    by 0x4008B2: main (kdeinit_kate.cpp:2)

However I think this might be a KDirWatch bug... will look further...
Comment 15 Israel Cabrera 2006-06-11 05:13:55 UTC
Maybe bug 119435 has something to do with this one.???
Comment 16 Hamish Rodda 2006-06-11 11:56:14 UTC
Created attachment 16556 [details]
Remove deleted subentries from parent entries in KDirWatch

Here's the patch which addresses the problem as demonstrated by Valgrind.  I'm
pretty sure this is due to KDirWatch, but I don't know why it only appeared
after inotify support was added, it seems as if FAM would trigger this bug too.


Please test, if others can confirm I'll reassign to kdirwatch.
Comment 17 Tais P. Hansen 2006-06-12 13:42:25 UTC
Created attachment 16568 [details]
Slightly modified version of Hamish Rodda's patch

So far, I haven't been able to provoke any crashes with this patch. Good job!

I had to add a class method declaration to your patch though for kdelibs to
compile without complaining.
Comment 18 Dirk Mueller 2006-06-13 12:42:25 UTC
looking
Comment 19 Dirk Mueller 2006-06-14 10:25:31 UTC
hmm, I'm not that happy with the patch, because the subentries should be removed as part of the removeEntry call already. Its more that the logic seems to be forgetting to do that when the entry is no longer watched. 

this doesn't seem inotify specific. I'll keep chasing it this evening. 
Comment 20 Hamish Rodda 2006-06-26 09:41:37 UTC
*** Bug 129810 has been marked as a duplicate of this bug. ***
Comment 21 Hamish Rodda 2006-06-26 09:43:07 UTC
The patch is about removing the entity which is being deleted from it's parent's list of subentries.

I believe this patch is right, and I agree that it isn't inotify specific (which is why I've patched other parts of code too)
Comment 22 Dirk Mueller 2006-06-27 09:00:58 UTC
*** Bug 127295 has been marked as a duplicate of this bug. ***
Comment 23 Dirk Mueller 2006-06-27 09:04:35 UTC
SVN commit 555364 by mueller:

Inotify looks nice at the first glance, but gets really really
ugly if you try to keep it behaviour-compatible with stat() code ;(
BUG:123315


 M  +47 -22    kdirwatch.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/kdirwatch.cpp #555363:555364
@@ -407,9 +407,6 @@
       if ( event->len )
         path = QFile::decodeName( QCString( event->name, event->len ) );
 
-      if ( event->mask & IN_IGNORED )
-        continue;
-
       if ( path.length() && isNoisyFile( path.latin1() ) )
         continue;
 
@@ -428,12 +425,15 @@
             if( event->mask & IN_DELETE_SELF) {
               kdDebug(7001) << "-->got deleteself signal for " << e->path << endl;
               e->m_status = NonExistent;
-              //(void) inotify_rm_watch( m_inotify_fd, e->wd );
-              addEntry(0, QDir::cleanDirPath(e->path+"/.."), e, true);
+              if (e->isDir)
+                addEntry(0, QDir::cleanDirPath(e->path+"/.."), e, true);
+              else
+                addEntry(0, QFileInfo(e->path).dirPath(true), e, true);
             }
+            if ( event->mask & IN_IGNORED ) {
+              e->wd = 0;
+            }
             if ( event->mask & (IN_CREATE|IN_MOVED_TO) ) {
-              kdDebug(7001) << "-->got new subfile " << path << " in " << e->path << endl;
-
               Entry *sub_entry = e->m_entries.first();
               for(;sub_entry; sub_entry = e->m_entries.next())
                 if (sub_entry->path == e->path + "/" + path) break;
@@ -727,7 +727,10 @@
     return true;
 
   if ( e->m_status == NonExistent ) {
-    addEntry(0, QDir::cleanDirPath(e->path+"/.."), e, true);
+    if (e->isDir) 
+      addEntry(0, QDir::cleanDirPath(e->path+"/.."), e, true);
+    else
+      addEntry(0, QFileInfo(e->path).dirPath(true), e, true);
     return true;
   }
 
@@ -782,6 +785,7 @@
        (*it).m_entries.append(sub_entry);
        kdDebug(7001) << "Added already watched Entry " << path
 		     << " (for " << sub_entry->path << ")" << endl;
+
 #ifdef HAVE_DNOTIFY
        Entry* e = &(*it);
        if( (e->m_mode == DNotifyMode) && (e->dn_fd > 0) ) {
@@ -798,6 +802,21 @@
          }
        }
 #endif
+
+#ifdef HAVE_INOTIFY
+       Entry* e = &(*it);
+       if( (e->m_mode == INotifyMode) && (e->wd > 0) ) {
+         int mask = IN_DELETE|IN_DELETE_SELF|IN_CREATE|IN_MOVE|IN_MOVE_SELF|IN_DONT_FOLLOW;
+         if(!e->isDir)
+           mask |= IN_MODIFY|IN_ATTRIB;
+         else
+           mask |= IN_ONLYDIR;
+
+         inotify_rm_watch (m_inotify_fd, e->wd);
+         e->wd = inotify_add_watch( m_inotify_fd, QFile::encodeName( e->path ), mask);
+       }
+#endif
+ 
     }
     else {
        (*it).addClient(instance);
@@ -928,8 +947,12 @@
         m_inotify_fd << ", "  << e->wd <<
         ") for " << e->path << endl;
     }
-    else
-      removeEntry( 0, QDir::cleanDirPath( e->path+"/.." ), e );
+    else {
+      if (e->isDir)
+	removeEntry(0, QDir::cleanDirPath(e->path+"/.."), e);
+      else
+	removeEntry(0, QFileInfo(e->path).dirPath(true), e);
+    }
   }
 #endif
 
@@ -1167,15 +1190,6 @@
       return Changed;
     }
 
-#ifdef HAVE_INOTIFY
-    // for inotify we delay the initial stating till the first event in it
-    if ( e->m_status == Normal && e->m_ctime == invalid_ctime )
-    {
-      e->m_ctime = stat_buf.st_ctime;
-      e->m_nlink = stat_buf.st_nlink;
-    }
-#endif
-
     return NoChange;
   }
 
@@ -1278,7 +1292,7 @@
   // removeDir(), when called in slotDirty(), can cause a crash otherwise
   delayRemove = true;
 
-#ifdef HAVE_DNOTIFY
+#if defined(HAVE_DNOTIFY) || defined(HAVE_INOTIFY)
   QPtrList<Entry> dList, cList;
 #endif
 
@@ -1306,6 +1320,16 @@
 
     int ev = scanEntry( &(*it) );
 
+
+#ifdef HAVE_INOTIFY
+    if ((*it).m_mode == INotifyMode && ev == Created && (*it).wd == 0) {
+      cList.append( &(*it) );
+      if (! useINotify( &(*it) )) {
+        useStat( &(*it) );
+      }
+    }
+#endif
+
 #ifdef HAVE_DNOTIFY
     if ((*it).m_mode == DNotifyMode) {
       if ((*it).isDir && (ev == Deleted)) {
@@ -1337,7 +1361,7 @@
   }
 
 
-#ifdef HAVE_DNOTIFY
+#if defined(HAVE_DNOTIFY) || defined(HAVE_INOTIFY)
   // Scan parent of deleted directories for new creation
   Entry* e;
   for(e=dList.first();e;e=dList.next())
@@ -1542,7 +1566,8 @@
 	kdDebug(7001) << "    dependent entries:" << endl;
 	Entry* d = e->m_entries.first();
 	for(;d; d = e->m_entries.next()) {
-	  kdDebug(7001) << "      " << d->path << endl;
+          kdDebug(7001) << "      " << d << endl;
+	  kdDebug(7001) << "      " << d->path << " (" << d << ") " << endl;
 	}
       }
     }
Comment 24 Andreas Kling 2006-07-14 06:52:43 UTC
*** Bug 130756 has been marked as a duplicate of this bug. ***
Comment 25 Andreas Kling 2006-07-16 12:31:24 UTC
*** Bug 118721 has been marked as a duplicate of this bug. ***
Comment 26 Andreas Kling 2006-07-16 12:40:30 UTC
*** Bug 118661 has been marked as a duplicate of this bug. ***
Comment 27 Andreas Kling 2006-07-25 19:39:04 UTC
*** Bug 128638 has been marked as a duplicate of this bug. ***
Comment 28 Andreas Kling 2006-07-25 19:48:21 UTC
*** Bug 128569 has been marked as a duplicate of this bug. ***
Comment 29 Andreas Kling 2006-08-27 15:44:29 UTC
*** Bug 133064 has been marked as a duplicate of this bug. ***