Bug 260309 - The cache corrupt message appears even if the respective directories are deleted
Summary: The cache corrupt message appears even if the respective directories are deleted
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: SVN
Platform: Ubuntu Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
: 262621 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-16 20:05 UTC by Sujith H
Modified: 2011-01-17 01:01 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6


Attachments
.xsession-errors file, a snapshot (329.07 KB, application/octet-stream)
2010-12-16 20:05 UTC, Sujith H
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sujith H 2010-12-16 20:05:30 UTC
Created attachment 54833 [details]
.xsession-errors file, a snapshot

Version:           SVN (using Devel) 
OS:                Linux

I was debugging, reason for the slowness of my system, after building kde from the trunk. Found that the message:

krunner(13883)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
krunner(13883)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
krunner(13883)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
krunner(13883)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
krunner(13883)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt.

and it goes on. I deleted the directories by executing the following commands:
*) cd `kde4-config --path cache`
*) rm -fr kpc icon-cache.kcache 

Again I can see the message related to currupt cache in the .xsession-errors file.

I hope this shouldn't occur once the directories are deleted.

Reproducible: Always

Steps to Reproduce:
Delete the directories using the method:
*) cd `kde4-config --path cache`
*) rm -fr kpc icon-cache.kcache 

Disable and enable the desktop effects after this.
The message will again come in the .xsession-errors file.
Comment 1 Michael Pyne 2010-12-17 02:51:31 UTC
Simply deleting directories does not cause a program to lose its connection to a shared cache (but it does prevent newly-started programs from being able to make a connection).

To completely close out a shared cache you should also close any programs that were using one (this essentially means any program built on the KDE platform though). So, if restarting the KDE session after removing the .kcache files doesn't solve the issue then please re-open this bug.
Comment 2 Sujith H 2010-12-17 05:07:02 UTC
Yes even if I restart the kde session after removing the .kcache files, the cache currupt message comes.
Comment 3 Martin Kho 2010-12-25 12:06:34 UTC
Hi,

I can confirm the messages appearing in Fedora rawhide. They only are there when desktop effects are active. (Tried a new user without desktop effects: no messages)

@comment 1: Only opening Kickoff gives these messages :-)

Currently running KDE 4.6 rc1. (for me, it started very early in the 4.6 cycle, when the new shared icon-cache entered)

Martin Kho
Comment 4 Martin Kho 2010-12-25 12:11:39 UTC
Hi,

May be it's relevant to tell that I'm using the nouveau-driver (GF 7600 GS, aka NV4B).

* xorg-x11-drv-nouveau-0.0.16-14.20101129gitf29afe6.fc15.x86_64
* xorg-x11-server-Xorg-1.9.99.1-2.20101201.fc15.x86_64

I'm using the OpenGL compositing type. To enable OpenGL:
* mesa-dri-drivers-experimental-7.10-0.17.fc15.x86_64

Martin Kho
Comment 5 Michael Pyne 2010-12-27 00:51:10 UTC
Well, it shouldn't be related to compositing or drivers per se. However, switching rendering mode to use composition might have KWin use KIconLoader/Plasma in a different code path, which eventually reaches into KSharedDataCache.

KSharedDataCache has been in use since 4.5, not 4.6. The 4.6 change was to output the warning about cache corruption since there were some users having crashes in 4.5 when changing the system time. I noted then that it is very likely a bug somewhere else (that I still haven't found :( ), but checking for that condition and turning it into a warning instead of a crash is my best solution so far.
Comment 6 Elias Probst 2011-01-05 12:08:53 UTC
I can confirm this. According to the .xsession-error entries, this is at least caused by 3 applications here:

kmix(3289)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
krunner(3264)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt. 
plasma-desktop(3161)/kdeui (KIconLoader): Trying to remove an entry which is already invalid. This  cache is likely corrupt.

I stopped my KDE session, cleaned up all cache directories and restarted KDE to make sure no old entries cause this error.
The KDE profile was completely reset before too, so no old config settings are involved.

KDE SC 4.6 RC1
Qt 4.7.1
Gentoo Linux
Kernel 2.6.36
Comment 7 Michael Pyne 2011-01-06 05:04:28 UTC
Well I've seen similar log output by now so I'll take the bug for now. Maybe I'll add some super-debugging output for 4.7 so I can see what operations are not completing right. As it is now though, the cache should be operating safely, even if you lose some of the performance benefit from its mis-organization.
Comment 8 Michael Pyne 2011-01-10 05:31:40 UTC
*** Bug 262621 has been marked as a duplicate of this bug. ***
Comment 9 Michael Pyne 2011-01-17 00:48:33 UTC
SVN commit 1214939 by mpyne:

Fully clear cache metadata in clearInternal().

KSharedDataCache uses the clearInternal() method to reset the cache, which is used if
corruption is detected, and when directed through KSharedDataCache::clear(). For whatever
reason I thought that simply setting the "first page" pointer for each possible index
entry would be sufficient, but that is not the case at all, as various methods which go
through the cache entries also check things such as the use count, last access time, etc.

Assuming no other errors (:-/) this should be the cause of bug 260309. (The
exact sequence would be a KSharedDataCache user runs ::clear(), later adds some
entries that invoke removeUsedPages(), and removeUsedPages() goes through *all*
index entries, including ones that appear to be in use since their use count is
>0, but their first page is still invalid). Easiest way to invoke this bug I've
found is to simply run "plasmoidviewer clock" at a konsole.

While reviewing code I also added a comment clarifying the usage of a page
variable as an index entry, and changed the index entry comparison functions to
look for any invalid page instead of checking for -1, as it takes me 5 minutes
every single time I review removeUsedPages to prove that -1 is the only
possible value <0. These changes will not be backported to KDE Platform 4.6.

CCBUG:260309


 M  +12 -7     kshareddatacache.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1214939
Comment 10 Michael Pyne 2011-01-17 01:01:52 UTC
SVN commit 1214946 by mpyne:

Backport "Fully clear cache metadata in clearInternal()" to 4.6.

KSharedDataCache uses the clearInternal() method to reset the cache, which is
used if corruption is detected, and when directed through
KSharedDataCache::clear().  For whatever reason I thought that simply setting
the "first page" pointer for each possible index entry would be sufficient, but
that is not the case at all, as various methods which go through the cache
entries also check things such as the use count, last access time, etc.

Assuming no other errors (:-/) this should be the cause of bug 260309. (The
exact sequence would be a KSharedDataCache user runs ::clear(), later adds some
entries that invoke removeUsedPages(), and removeUsedPages() goes through *all*
index entries, including ones that appear to be in use since their use count is
>0, but their first page is still invalid). Easiest way to invoke this bug I've
found is to simply run "plasmoidviewer clock" at a konsole.

This should fix the annoying bug 260309 just in time for KDE Platform 4.6. I'm
CC-ing release team so that there are no surprises, but I have hopefully
demonstrated enough of the issue to prove that this patch is at least "more
correct" than previous behavior.

It is possible that this was also the proximate cause of the Plasma crashes
when changing the system time for Daylight Savings (which I worked around with
the error message you've been seeing for months), bug 253795.

FIXED-IN:4.6
BUG:260309
CCBUG:253795
CCMAIL:release-team@kde.org


 M  +5 -0      kshareddatacache.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1214946