[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 87163] kaddressbook empties resource on some conditions (data
From:       Michael Reiher <michael.reiher () gmx ! de>
Date:       2005-11-17 23:29:19
Message-ID: 20051117232919.30586.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=87163         




------- Additional Comments From michael.reiher gmx de  2005-11-18 00:29 -------
Ah, thanks for the reminder...

A few weeks ago I made the attached patch and did a little rotating of my X 
logs (see end of this message) to possibly find out whats going on. 

This really should be fixed in some or the other way for 3.5! Loosing data is 
the worst that can happen! What I mean is, if it's currently not possible to 
find the real cause of these losses, then at least some precautions should be 
taken to avoid data loss as good as possible. At the moment the actually 
existing backups are plain useless, as they are rotated away silently and 
user has no chance to react! Aside from the real cause, it actually doesn't 
matter whats wrong. There can always be a reason why saving fails, a bug in 
the saving alghorithm, program or system crash, disk full or what ever. So 
this precaution would generally be useful. What could be done IMO is this: 

 - 1. Don't save the addressbook if the written file size is 0. As this 
indicates that something went wrong during save. Give an error to the user. 
This should also abort a running logout. (A solution for saving an 
intentionaly empty addressbook would need to be found, though)

 - 2. Don't do a backup if the original file has size 0 (never, intentionally 
empty or error doesn't matter). In this case there is nothing to backup.

This should make sure that a) the user knows about the problem and b) the 
existing backups don't get rotated away silently.

 - 3. On addressbook startup: if addressbook file size is 0, but there are 
backups, ask the user to restore. (Again intentional empty addressbooks have 
to be handled in some way.)

The problem is that I have no idea about the internals of 
kaddressbook/kdepim to provide a proper solution. I'm already glad I 
found the place where the backup apparently happens :) But hopefully it still 
helps in some way. The attached patch is mostly for illustration of what I 
mean by 1. and 2. But, it basically seems to work and prevent data loss. It 
doesn't address the issue of intentionally empty addressbooks. Also the 
addressBook()->error() apparently doesn't abort shutdown.

Looking at the logs, could it be that there are more than one processes or 
threads trying to save at the same time and get in the way? Some of my logs 
("######### RESOURCE: ...") are missing even though they should be there.

Please, find some solution for this problem!

Greetings

Michael


The X logs from failure cases. This always during KDE shutdown. I only grepped 
the kabc messages. If you need more, I have the full logs still around.

----- Failure case 1 ------------------------------------------------------

kabc: StdAddressBook::saveAll()
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: Lock::lock()
kabc: -- lock 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcf.lock
kabc: ######### RESOURCE: Saving file seems successful! Size > 0: 13956. 
Making it permanent!
kabc: stale temp file detected /tmp/kde-michael/kontactG72bsa.tmp
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: Lock::lock()
kabc: -- lock 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcf.lock
kabc: -- lock unique 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcflv3t8ryw
kabc: AddressBook::save()
kabc: ResourceFile::save()
kabc: ######### RESOURCE: Original file size > 013956. Doing backup!
kabc: ######### RESOURCE: Saving file probably failed! Size is 0. ABORTING 
save!
kabc: ######### RESOURCE: Saving file failed!
kabc: StdAddressBook::saveAll()
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: Lock::lock()
kabc: -- lock 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcf.lock
kabc: -- lock unique 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcfU31XuCyB
kabc: AddressBook::save()
kabc: ResourceFile::save()
kabc: ######### RESOURCE: Original file size > 013956. Doing backup!
kabc: ######### RESOURCE: Saving file probably failed! Size is 0. ABORTING 
save!
kabc: ######### RESOURCE: Saving file failed!


----- Failure case 2 ------------------------------------------------------

kabc: ######### RESOURCE: Saving file seems successful! Size > 0: 13956. 
Making it permanent!
kabc: stale temp file detected /tmp/kde-michael/kontactnwAiab.tmp
kabc: StdAddressBook::saveAll()
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: Lock::lock()
kabc: -- lock 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcf.lock
kabc: -- lock unique 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcfVUY7oep2
kabc: AddressBook::save()
kabc: ResourceFile::save()
kabc: ######### RESOURCE: Original file size > 013956. Doing backup!
kabc: ######### RESOURCE: Saving file probably failed! Size is 0. ABORTING 
save!
kabc: ######### RESOURCE: Saving file failed!


----- Failure case 3 ------------------------------------------------------

kabc: StdAddressBook::saveAll()
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: stale temp file detected /tmp/kde-michael/kontacttxt9Wa.tmp
kabc: StdAddressBook::saveAll()
kabc: AddressBook::requestSaveTicket()
kabc: ResourceFile::requestSaveTicket()
kabc: Lock::lock()
kabc: -- lock 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcf.lock
kabc: -- lock unique 
name: /home/michael/.kde/share/apps/kabc/lock/_home_michael_.kde_share_apps_kabc_std.vcfryrCbntQ
kabc: AddressBook::save()
kabc: ResourceFile::save()
kabc: ######### RESOURCE: Original file size > 013956. Doing backup!
kabc: ######### RESOURCE: Saving file probably failed! Size is 0. ABORTING 
save!
kabc: ######### RESOURCE: Saving file failed!


Created an attachment (id=13521)
 --> (http://bugs.kde.org/attachment.cgi?id=13521&action=view)
resourcefile.diff
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic