signalapp / Flock

Private contact and calendar sync for Android.
https://signal.org/blog/flock
357 stars 80 forks source link

Lost Contacts #95

Open Ste4thOverride opened 9 years ago

Ste4thOverride commented 9 years ago

I had all my contacts synced with this app. I had to perform a factory reset on my phone Nexus 5. Upon reinstall all 297 of my contacts are gone!! This is a serious f****\ issue I have important business contacts. The app brought back my calendar events but not all of my contacts.

https://gist.github.com/c599ceb5af9fb37a161e

rhodey commented 9 years ago

hi @Ste4thOverride, very sorry for the trouble. when did you capture the debug log that you included in this issue? this debug log seems to indicate that your contacts are stored both locally on your device and remotely on the sync server as expected. even the count of 297 contacts matches as seen here

can you explain in detail:

1) what you did and experienced before capturing this debug log 2) what you did and experienced after capturing this debug log 3) how you are verifying that your contacts have been deleted 4) any non-stock ROMs or modifications you've made to your device.

thanks.

Ste4thOverride commented 9 years ago

I updated my device recently to Android 5.1 Build LMY47I. I reinstalled all my apps and data using adb restore as I have done before with no issues. When I attempted to send a Text Message I noticed the person was not showing up in the recipient list. I opened the default contact manager and only about 12 contacts where showing up. Clicking Resync within the flock app and Restarting had no affect. Even completely removing the app and starting from beginning did not bring my contacts back.

I thankfully keep multiple backups and was able to restore my contacts back using a vcard backup. If the debug log is showing the contacts are there even when they aren't there that's a serious issue.

My Device is Nexus 5 Rooted But stock ROM with no changes to the underlying OS or Kernel.

rhodey commented 9 years ago

@Ste4thOverride thanks for the context. if you could let me know where in that sequence of events you captured the debug log that is referenced above that should help clear things up even more. Without that info there is still a lot of things I'm unsure of, but I can speculate a bit.

Given your backup and restore process I could maybe see how this might happen. Flock keeps a version tag called a CTAG locally and on the sync server. This version tag is used to figure out which copy of the contacts is more recent, the contacts on the server or the contacts on your Android device. The rules go like this:

1) if the server has no version tag, the contacts on your device are most recent. 2) if your device has no version tag, the contacts on the server are most recent. 3) if your device and the server have the same version tag, the contacts on your device are most recent. 4) if your device and the server have different version tags, the contacts on the server are most recent.

So, when you restored your Flock app from the backup I would expect that the version tag for your contacts would be restored-- and if Flock was restored before your contacts were restored then the app thinks:

the server and I have the same version tag, so my contacts are either in sync with what is on the server or newer than what is on the server (number 3 above), I should check and see which of these is true

Then when Flock checks in with the server it would see that the server has 297 contacts while it has 0 contacts stored locally, and because the version tag says your device has the most resent state Flock needs to update the state of the contacts on the server-- by deleting 297 contacts.

The information in the debug log is still very much an open question but your back up and restore process has definitely exposed a potential problem which I had not thought about before. I'm going to mark this as a bug and attempt to reproduce your backup and restore process on my own device, I'll check back in ASAP. Once more, sorry for the trouble and thanks for all this info, it should definitely help with reliability in future releases.

Ste4thOverride commented 9 years ago

I created the debug log after the restore but before I wiped everything out and started new if that helps.

nysatrok commented 9 years ago

This is related to #83 and I've experienced the same problem that happened in the debug log. Also the contacts can't be deleted from the server afterwards. If you press the delete-all-contacts button, the contacts remain on the server and can't be imported. The only option is to delete the entire account.