KeePass file gets overwritten by old version

Seafile Server 6.0.8 community editon
Seafile Windows Client 1 6.0.4
Seafile Windows Client 2 6.0.4
Seafile Android Client 2.1.11

Hi everyone,
I ve been using Seafile since several years now without any major incidentents until a couple weeks before.
I got a KeePass DB-file saved in my main folder thats synced with both PCs. After some changes and a few days a previous version was somehow uploaded as the newest version. I could (luckily) retrieve the real newest file via the versions function from the webinterface.
Same happend just a few days ago: I changed the KeePass file and saved it on a PC. In the meantime I opened it on my phone. Today i got a current version from “2 days ago” and two history versions from “2 days ago” and “4 days ago”, The version from “4 days ago” actually contains the most recent changes.

Is there any log file where i could see which client messed things up?

I do not have this issue, as KeePass merges changes here. The issue can happen in case you change on PC, open on (the old version, the changes one from the PC is uploaded short after that) and save with phone without merging (possibly there is no such option). I don’t see an issue with Seafile here.

I know what you mean, but that would be stupid. I never did any changes to the KeePass file on my phone. I am sure to have never edited an old version on the PC and saved it. I usually keep the KeePass file closed.

My question stays the same: Is there a way to see which file-update was done by which client?

If it is the pro version there is an audit log. That could contain such information.

It’s the community editon

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