KeePass file gets overwritten by old version

I just read about a similiar problem in a different thread about an outdated cache on one client. Maybe this could help you?

https://forum.seafile.com/t/files-getting-randomly-deleted/1790/3

Hi Patrick, thanks for your reply. Unfortunately I have no idea how to narrow down the cause of this issue. I would really like to help find the bug.

I would try to reinstall the seafile clients and delete all the cache files on all clients (I assume, you don’t have that many :slight_smile:) Maybe it’s worth a try.

Well … my opinion on this is that either the root of this problem gets solved or Seafile is not usable for me. If a file gets randomly modified by the cloud software it could cause very bad situations.

Have you any evidence that Seafile does something like that? From my point of view there is nothing solid indicating that there’s something wrong with Seafile so far.

I do also use Seafile and KeePass 2 (for something like 2 years now) and didn’t have this problem, so far.

From my point of view it is pretty bad for Seafile to overwrite a file with its previous version. That could lead into big problems and cause the whole software to be useless, unfortunately!

I can absolutly rule out that that I personaly caused the problem. And even if the user would edit one file to two different states, Seafile should create a version-conflict-file or similar…

I am not sure wheter it is specific to KeePass files. I only happen to notice the changes to this file … I am actually quite scared that some other files might be corupted by now as well.

I went through the nginx access.log, at least for an hour or two …

1) correct version:
uploaded [03/May/2017:23:21:38 +0200] (“7 days ago”) by “N-Laptop” (Windows Client)
obj_id=3a41438f0ef36af8b9df4c9403203b9abf2bfdc8
commit_id=a4ca23fb558f0f3cbff552e51417c226ddbc501a

looking at the logs it looks pretty normal

2) replaced by old version:
4 days ago (Seafile mouse hover: 6. Mai 2017 12:47:03 +0000)
obj_id=21cb492dadc91fb0bc7f53f8660524d919bdfc4e
commit_id=c5deedde5e5aa66e7383d48033f7a46d38a10d85&p=/nk.kdbx

only log entries in nginx access.log at around that time:

MyPhoneIP - - [06/May/2017:14:46:55 +0200] “GET /api2/repos/cddbc99b-851d-435d-a32c-2dc4efe13c7a/update-link/ HTTP/1.1” 200 89 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:03 +0200] “POST /seafhttp/update-api/076c06e2-b875-414d-8149-66c783ec1dbf HTTP/1.1” 200 40 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:08 +0200] “GET /api2/repos/cddbc99b-851d-435d-a32c-2dc4efe13c7a/update-link/ HTTP/1.1” 200 89 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:08 +0200] “GET /api2/repos/cddbc99b-851d-435d-a32c-2dc4efe13c7a/update-link/ HTTP/1.1” 200 89 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:13 +0200] “POST /seafhttp/update-api/43d6ea67-7953-4f18-bf10-914f3a512b26 HTTP/1.1” 200 40 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:23 +0200] “GET /api2/repos/cddbc99b-851d-435d-a32c-2dc4efe13c7a/update-link/ HTTP/1.1” 200 89 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:29 +0200] “POST /seafhttp/update-api/2832ca47-523b-41f9-ade0-36b47bfde74d HTTP/1.1” 200 40 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”
MyPhoneIP - - [06/May/2017:14:47:30 +0200] “POST /seafhttp/update-api/40d85e85-3e29-459c-b599-dca9db36d97a HTTP/1.1” 200 40 “-” “Dalvik/2.1.0 (Linux; U; Android 7.1.1; Aquaris X5 Plus Build/NMF26F)”

I can not find any occurrence of either the obj_id or commit_id of the 2)-file in the access.log files…

As far as I can tell the Android client caused the problem.

I know that I can manually upload a file in the Android client, but does the app contain any “feauture” to auto-upload a file if it things it was changed?

I opend the KeePass file on my Android at least on May 5th, but can not remember if it contained the changes or not.
Probably KeePass Android set the last-changed date to the last accessed date (i did not do any changes!) and Seafile Android thought because of the newer date of the file on the phone it should update the version on the server automaticly (I did not do any manual upload!)

I think, the new server version 6.1.0 could help: Seafile version 6.1.0 beta is ready for testing! (have a look at “Improvement for administation”)

best reagrds
Markus

I also use Keepass (2.28) on a few Windows computers. I occasionally have an issue with file conflicts, in which case a conflict database is saved that I can merge, but not had an old database show up.
I used KeePassDroid on my Android phone to read my keepass db. I am pretty sure that opening it in this app creates a separate local copy that Seafile is not keeping an eye on, so it doesnt try to upload the copy again.

I ran into a similar issue with my android client uploading files that had not changed when I opened them in an Office App (WPS Office I think) on my phone. If I opened a Word doc, PDF, etc in this program from the Seafile client, then it would somehow think the file was changed an eventually upload over the server copy. Sometimes this caused the problem of the android client overwriting a newer server copy. I also have encrypted libraries on the server, not sure if that comes into play at all.

Long winded way of saying, what Android client are you using for Keepass? If not KeePassDroid, maybe you try that one for a bit to see if your problem goes away.

I installed the 6.1.0 beta almost immediately and after I found out about the 2nd history page for the library (I only knew the one for files) i saw this for the specific file & time:

Not very helpfull, but it still indicates that my guess of the Android App bei naughty being true.

My question at this point: is it true, that the Seafile Android App does have a auto-upload feature if files get changed?

My problem might be connected to this one: Android client doing unwanted uploads

I also noticed very high data usage: 661 MB during the last 12 days, besides I hardly used the Seafile app on my phone activly. I have the auto upload feature for camera folder activated but only if I am connected over WiFi.

I use KeePassDroid as my KeePass Android App. KeePassDroid does not create a copy upon opening the database file, but as far as I can tell it does not change the time or date as well!?

Yes, the Android App does have an auto-upload feature. This feature not working well. We will turn it off in the next release.

With the problem I had on the Office style application, I had a couple of files that were trying to upload unsuccessfully over my cellular data. It consumed over 1 GB of data in just a few hours. I only noticed because my phone was hot and then I looked at data usage. The files would upload to about 99% and then fail and start again. My solution was to disable use of background data for Seafile. This way it would only use data when I had the app open and was actively doing something. This might help with your data consumption.

Please rather fix than remove the feature.

One solution could be adding an api where you provide the has of the file you’re trying to overwrite that only accepts an upload if the hash matches. Thus in case the file was updated in the meantime the app could create a conflict file instead (the api could even allow enabling this via option).

This change is not mentioned in the change-log for the android app. I would like any information wheter it is safe to reinstall the app

It is safe to re-install the app. We added the feature that when the app get notified that a file is updated, the file will only be uploaded if the size is different. This will prevent fake update.

But also some normal changes. Open md, correct typo and the size won’t change.

Shouldn’t the hash value still change?

Yes, but afaik only the size is being used. The problem is that Seafile currently does not store hashes for files and thus does not have an API to retrieve a files hash.

@daniel.pan Will this be changed at some point?