Bug 226742 - data loss on system crash (but only KDE applications)
Summary: data loss on system crash (but only KDE applications)
Status: RESOLVED FIXED
Alias: None
Product: kwalletmanager
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: VHI major
Target Milestone: ---
Assignee: Valentin Rusu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-13 23:52 UTC by post
Modified: 2015-05-06 15:39 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description post 2010-02-13 23:52:29 UTC
Version:           1.4 (using 4.3.4 (KDE 4.3.4), Debian packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.33-rc8

Hi,

KDE application have a VERY strange behaviour: the tend to loose their settings or similar data. Image a crashing kernel. Why is my kwallet gone on the next start? I did NOT write to it! Since last boot, it only read from that file. Same goes for e.g. KMail settings. Something is severely broken in KDE.
It would be understandable if I wrote to that file before the crash but I didn't. Additionally, this only happens to KDE applications. Others like e.g. Firefox/Iceweasel are not affected.

Please reassign this to the proper KDE sub-group.

System:
Debian testing with self-compiled kernel
/home is XFS filesystem
Comment 1 benni 2010-10-21 11:23:18 UTC
Same happened here after power failure. ALL data is gone.
Comment 2 benni 2010-10-21 11:24:54 UTC
(In reply to comment #1)
> Same happened here after power failure. ALL data is gone.

KDE 4.5.2 , Ext4 , Kernel 2.6.35
Comment 3 post 2011-05-13 16:38:19 UTC
I updated to KDE-4.6.2 and this still happens! KMail open during crash? Sorry, please reconfigure all your Offline-IMAP stuff and please also redownload all mails from all IMAP folders. THIS SUCKS.

Firefox/Iceweasel even offers me to recover the last session and KDE cannot even keep the _unchanged_ configuration!
Comment 4 Valentin Rusu 2013-09-23 22:03:53 UTC
(In reply to comment #3)
> I updated to KDE-4.6.2 and this still happens! KMail open during crash?
> Sorry, please reconfigure all your Offline-IMAP stuff and please also
> redownload all mails from all IMAP folders. THIS SUCKS.
> 
> Firefox/Iceweasel even offers me to recover the last session and KDE cannot
> even keep the _unchanged_ configuration!
Is your problem related to kwallet? Seems to me you have problems with kmail. Could you please confirm?
Comment 5 Valentin Rusu 2013-09-23 22:19:08 UTC
kwalletd uses KSaveFile API when syncing wallet to disk. This API internally creates a temporary file, in the same location where the regular kwl file is located, using a temporary name. When all the syncing is done, the old file is deleted and the temporary one is renamed. If power outage occurs when this file is replaced, then data may dissapear.

In order to reduce the risk, I recommend defining KDE_EXTRA_FSYNC environment variable in your KDE session. For example, you could add #define KDE_EXTRA_FSYNC=1 in your ~/.profile

Also, after inspecting kwalletd I can tell that it needs some more error handling, in order to make you aware about disk syncing failures. Now working on this issue.
Comment 6 Valentin Rusu 2013-09-27 22:59:28 UTC
Git commit 693b04a03f7cc086550994b4abf4746feeedc9be by Valentin Rusu.
Committed on 27/09/2013 at 22:53.
Pushed by vrusu into branch 'master'.

Add a KDE notification when wallet sync to disk fails
FIXED-IN: 4.12

This does not really fixes the bug, as I'm not able to reproduce it
and never happened on my system. However, KSaveFile's logic may fail
and kwalletd did not took that into account. When such a failure
occurred, kwalletd silently ignored the errors. This fixes that and
adds a system notification to let the user know that something is
wrong with the disk (disk full, r/W error, etc.)

M  +1    -0    kwalletd/backend/backendpersisthandler.cpp
M  +10   -1    kwalletd/backend/kwalletbackend.cc
M  +5    -0    kwalletd/kwalletd.notifyrc

http://commits.kde.org/kde-runtime/693b04a03f7cc086550994b4abf4746feeedc9be
Comment 7 Valentin Rusu 2013-09-27 23:03:17 UTC
*** Bug 325165 has been marked as a duplicate of this bug. ***
Comment 8 Hans-Peter Jansen 2015-05-06 15:39:27 UTC
Just to clarify: loosing data through kwalletmanager always happened silent to me.