signalapp / Flock

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

Contact sync fails on nexus7 with slimkat ROM #43

Closed cjeanneret closed 10 years ago

cjeanneret commented 10 years ago

Hello,

Seems I'm unable to retrieve my contacts using latest Flock version (available on f-droid). Logs doesn't help much so far:

08-03 15:17:46.221  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ pullRemotelyChangedComponents()
08-03 15:17:47.573  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ found + 130 remote components
08-03 15:17:48.624  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ pullRemotelyDeletedComponents()
08-03 15:17:49.835  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ found 130 remote components
08-03 15:17:49.835  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ found 0 local components
08-03 15:17:49.835  23302-23660/org.anhonesteffort.flock:flock D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ remote ctag post pull remote: 317905_346204
08-03 15:17:49.835  23302-23660/org.anhonesteffort.flock:flock W/org.anhonesteffort.flock.sync.AbstractDavSyncWorker﹕ sync result has errors, will not save remote CTag to local collection

I'll try to add some more debug in the app in order to get some more information…

cjeanneret commented 10 years ago

small up, seems the W message is generated here:

        if (remoteCTag.isPresent()) {
          Log.d(TAG, "remote ctag post pull remote: " + remoteCTag.get());

          if (result.stats.numAuthExceptions  > 0 ||
              result.stats.numSkippedEntries  > 0 ||
              result.stats.numParseExceptions > 0 ||
              result.stats.numIoExceptions    > 0)
          {
            Log.w(TAG, "sync result has errors, will not save remote CTag to local collection");
            return;
          }

I'll try to dig a bit more in the result.stats.* stuff in order to get some more information regarding the one that crashes.

rhodey commented 10 years ago

Hey @cjeanneret I'd love to help you out here and I'll try to provide support when I get the time but unfortunately we have to treat any issues arising from this F-Droid APK as low priority because we did not build, sign, or upload that APK.

The Flock F-Droid listing was created and continues to be maintained against our will. I have no idea what that APK contains, for all I know it could be malware. For a history on why we're against distributing on F-Droid please see >> https://github.com/whispersystems/textsecure/issues/127

If you prefer not to download APKs from Google Play I can understand that, but our recommended alternative is './gradlew build', not F-Droid. We worked hard to make it easy as possible to build Flock from source, see >> https://github.com/WhisperSystems/Flock/blob/master/BUILDING.md

Labelling as "F-Droid" for now, will check back in when I can, sorry!

cjeanneret commented 10 years ago

Heya @rhodey — bad move from f-droid if it's against your will… (saying I'm wanting to push my own app on their repo and being unable to create the post in submission -.-')

So I'll build it this evening and give it a new try. I keep you updated, maybe it won't be an f-droid issue ;).

rhodey commented 10 years ago

@cjeanneret yes the issue could definitely be unrelated to the F-Droid APK, I don't mean to diminish the worth of your github bug report at all :)

We have been in contact with F-Droid since fist discovering their Flock APK and they have assured us that is in the process of being removed from their listings. Sorry for all the drama, let me know how the build goes.

cjeanneret commented 10 years ago

Hello @rhodey :) So, I've built the APK based on sources from this morning. And contacts are still absent, but now I think I may provide some more information.

After some tests and tries, it seems the privacyguard was interfering with flock in a really bad way:

I give you the log output for the sync so that you may refer to it if, later, someone has the same problem ;).

D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker( 8791): remote component 550d71fa-7e48-4651-a3d4-707219a2869a not present locally
D/org.anhonesteffort.flock.sync.AbstractDavSyncWorker( 8791): creating local component 550d71fa-7e48-4651-a3d4-707219a2869a using remote
D/org.anhonesteffort.flock.sync.addressbook.ContactFactory( 8791): no photos found in vcard, returning absent
D/org.anhonesteffort.flock.sync.AbstractLocalComponentCollection( 8791): commitPendingOperations()
E/DatabaseUtils(11674): Writing exception to parcel
E/DatabaseUtils(11674): android.content.OperationApplicationException: App op not allowed
E/DatabaseUtils(11674):     at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:254)
E/DatabaseUtils(11674):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:192)
E/DatabaseUtils(11674):     at android.os.Binder.execTransact(Binder.java:404)
E/DatabaseUtils(11674):     at dalvik.system.NativeStart.run(Native Method)

This, of course, explains a lot why I don't have my contacts.

At the end of the unsuccessful sync, here's some more information:

E/AndroidRuntime( 8791): FATAL EXCEPTION: pool-1-thread-1
E/AndroidRuntime( 8791): Process: org.anhonesteffort.flock:flock, PID: 8791
E/AndroidRuntime( 8791): java.lang.IllegalArgumentException: Base64-encoded string must have at least four characters, but length specified was 3
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.util.Base64.decode(Base64.java:1202)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.util.Base64.decode(Base64.java:1308)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.util.Base64.decode(Base64.java:1265)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.sync.addressbook.ContactFactory.getValuesForNote(ContactFactory.java:874)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.sync.addressbook.LocalContactCollection.addComponent(LocalContactCollection.java:624)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.sync.AbstractDavSyncWorker.pullRemotelyCreatedComponents(AbstractDavSyncWorker.java:512)
E/AndroidRuntime( 8791):    at org.anhonesteffort.flock.sync.AbstractDavSyncWorker.run(AbstractDavSyncWorker.java:126)
E/AndroidRuntime( 8791):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 8791):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 8791):    at java.lang.Thread.run(Thread.java:841)
D/org.anhonesteffort.flock.sync.AbstractDavSyncAdapter( 8791): completed sync for authority >> com.android.contacts
D/SyncManager( 1503): failed sync operation SwissTengu@flock u0 (openwhispersystems.org), com.android.contacts, SERVER, latestRunTime 275083886, reason: AutoSync, SyncResult: stats [ numParseExceptions: 218]
D/AccountTypeManager( 5460): Registering external account type=openwhispersystems.org, packageName=org.anhonesteffort.flock
I/ActivityManager( 1503): Killing 3533:com.android.packageinstaller/u0a29 (adj 15): empty #17
I/AccountTypeManager( 5460): Loaded meta-data for 2 account types, 1 accounts in 13ms(wall) 5ms(cpu)
D/SyncManager( 1503): not retrying sync operation because the error is a hard error: SwissTengu@flock u0 (openwhispersystems.org), com.android.contacts, SERVER, latestRunTime 275339956, reason: AutoSync

It would be interesting to dig a bit deeper into this, though, in the end, it wasn't a problem at Flock level, but more due to my paranoia I guess.

I'll see if it's the same problem for the calendar sync (#44) and update the issue accordingly.

Cheers,

C.