Bug 307388 - Regression: crash in KInotify::Private::_k_addWatch
Summary: Regression: crash in KInotify::Private::_k_addWatch
Status: RESOLVED FIXED
Alias: None
Product: nepomuk
Classification: Miscellaneous
Component: filewatch (show other bugs)
Version: 4.9
Platform: Fedora RPMs Linux
: NOR critical
Target Milestone: ---
Assignee: Nepomuk Bugs Coordination
URL: https://bugzilla.redhat.com/show_bug....
Keywords:
: 306573 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-25 16:23 UTC by Daniel Vrátil
Modified: 2012-10-03 11:28 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.3


Attachments
valgrind log (53.34 KB, text/plain)
2012-09-26 16:55 UTC, Hussam Al-Tayeb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Vrátil 2012-09-25 16:23:30 UTC
We have an upstream crash report [0] (backtrace [1]) in KInotify::Private::_k_addWatch when checking whether dirIterators QQueue is empty.

This is a regression introduced by fix [2] of bug 305685

[0] https://bugzilla.redhat.com/show_bug.cgi?id=858271
[1] https://bugzilla.redhat.com/attachment.cgi?id=614030
[2] http://commits.kde.org/nepomuk-core/d16e80a9e4ad6e947f5618e05e33d3267609a0dd

Reproducible: Sometimes
Comment 1 Kevin Kofler 2012-09-25 22:20:18 UTC
> We have an upstream crash report

s/upstream/downstream/ ;-)

But I don't see how this would crash when the previous version didn't, given how the next line wants to take the first element of the same list! If even isEmpty crashes, how can that not have crashed?
Comment 2 Vishesh Handa 2012-09-26 13:03:36 UTC
*** Bug 306573 has been marked as a duplicate of this bug. ***
Comment 3 Hussam Al-Tayeb 2012-09-26 14:17:36 UTC
reverting http://commits.kde.org/nepomuk-core/d16e80a9e4ad6e947f5618e05e33d3267609a0dd doesn't fix it for me.
Comment 4 David Faure 2012-09-26 15:59:04 UTC
Yeah, that commit can't possibly be guilty.

Hussam, or anyone else who is compiling from sources and hitting this bug: can you run the process in valgrind, in order to get a valgrind log of the crash?

This would be something like killing the running nepomukfilewatch, 5 times in a row (to disable the automatic restart) and then:

valgrind --partial-loads-ok=yes nepomukservicestub nepomukfilewatch
Comment 5 Hussam Al-Tayeb 2012-09-26 16:55:31 UTC
Created attachment 74183 [details]
valgrind log

valgrind log. I'm not sure I did this correctly. it not, let me know please :)
Comment 6 Hussam Al-Tayeb 2012-09-29 18:08:51 UTC
Will I break anything if I compile the nepomuk-core 4.9.0 package and install it instead of 4.9.1?
Comment 7 Hussam Al-Tayeb 2012-09-29 18:09:06 UTC
just to check if this fixes things.
Comment 8 David Faure 2012-10-01 15:15:40 UTC
Thanks for the valgrind trace, that helps.

http://www.davidfaure.fr/2012/nepomukfilewatch.cpp.diff should fix it, please test.
Comment 9 Andreas Sturmlechner 2012-10-01 21:26:44 UTC
Patch applied, segfault eliminated - thank you very much!

Plus, I can only reiterate the awesomeness of /etc/portage/patches :)
Comment 10 Hussam Al-Tayeb 2012-10-01 21:34:19 UTC
seems fixed here too. thank you :)
Comment 11 David Faure 2012-10-02 18:28:54 UTC
Git commit 804e54f83ade8a377d392d350981ead07f60a9d3 by David Faure.
Committed on 02/10/2012 at 20:27.
Pushed by dfaure into branch 'KDE/4.9'.

Fix crash when watchUserLimitReached() leads to deleting the KInotify instance

... which emitted the signal. So don't use a direct delete.
FIXED-IN: 4.9.3

M  +2    -1    services/filewatch/nepomukfilewatch.cpp

http://commits.kde.org/nepomuk-core/804e54f83ade8a377d392d350981ead07f60a9d3
Comment 12 Kevin Kofler 2012-10-02 23:05:51 UTC
Unfortunately, your fix is not sufficient. We've just gotten this crash report from the build with your fix:
https://bugzilla.redhat.com/show_bug.cgi?id=862369
I think this probably needs an if (m_dirWatch) check around the m_dirWatch->deleteLater(); call (delete automatically checks for NULL, deleteLater() is a method and so it won't work if you call it on NULL).
Comment 13 Daniel Vrátil 2012-10-03 11:28:13 UTC
Git commit 32b44881dda4f243932c59c11bf39c91f30c224b by Dan Vrátil.
Committed on 03/10/2012 at 13:27.
Pushed by dvratil into branch 'KDE/4.9'.

Add null-crash guards for m_dirWatch to FileWatch

M  +8    -3    services/filewatch/nepomukfilewatch.cpp

http://commits.kde.org/nepomuk-core/32b44881dda4f243932c59c11bf39c91f30c224b