Sync fails with Nextcloud



  • DAVdroid 1.3.4.1/ose
    Nextcloud 10.0.2
    (some large contact pictures)

    The initial sync fails - different contacts get synced every time.
    While this well might be a nextcloud problem, I believe that DAVdroid should incrementally sync the contacts and eventually all contacts should be synchronized.

    There are 229 contacts in the address book:
    [syncadapter.ContactsSyncManager] Downloading 229 contacts (10 at once)

    at.bitfire.davdroid:sync W/art: Suspending all threads took: 10.886ms
    at.bitfire.davdroid:sync W/art: Suspending all threads took: 6.417ms
    at.bitfire.davdroid:sync W/davdroid: [syncadapter.SyncManager] I/O exception during sync, trying again later
                                                                        EXCEPTION java.net.SocketTimeoutException: timeout
                                                                            at okio.Okio$4.newTimeoutException(Okio.java:227)
                                                                            at okio.AsyncTimeout.exit(AsyncTimeout.java:274)
                                                                            at okio.AsyncTimeout$2.read(AsyncTimeout.java:242)
                                                                            at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325)
                                                                            at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314)
                                                                            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
                                                                            at okhttp3.internal.http1.Http1Codec.readResponse(Http1Codec.java:191)
                                                                            at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:132)
                                                                            at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:54)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at at.bitfire.dav4android.BasicDigestAuthHandler.intercept(BasicDigestAuthHandler.java:290)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at at.bitfire.davdroid.HttpClient$UserAgentInterceptor.intercept(HttpClient.java:164)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
                                                                            at okhttp3.RealCall.execute(RealCall.java:63)
                                                                            at at.bitfire.dav4android.DavAddressBook.multiget(DavAddressBook.java:111)
                                                                            at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(ContactsSyncManager.java:326)
                                                                            at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:170)
                                                                            at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.onPerformSync(ContactsSyncAdapterService.java:66)
                                                                            at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)```

  • developer

    While this well might be a nextcloud problem, I believe that DAVdroid should incrementally sync the contacts and eventually all contacts should be synchronized.

    This is exactly what DAVdroid does. It never downloads more than 10 contacts at once.

    at.bitfire.davdroid:sync W/davdroid: [syncadapter.SyncManager] I/O exception during sync, trying again later
    EXCEPTION java.net.SocketTimeoutException: timeout

    You're experiencing a server timeout. Please contact your server admin and/or Nextcloud support.



  • I am syncing from nextcloud to android. When the systems works as you describe, I would assume that number of contacts on the phone should constantly increase until all the contacts are synced.
    I would expect that with an increasing number of contacts on the phone, the number of contacts to download from the server should decrease.

    With every sync I always get: Downloading 229 contacts (10 at once)

    Why does that number not go down?

    Thanks


  • developer

    @hey Because the server times out when DAVdroid tries to download the first bunch of 10 contacts.

    Currently, the read timeout is set to 120 seconds, which should be more than enough to send the first octet of 10 contacts.

    Why do you think this is a DAVdroid problem?



  • because I do see DAVdroid reading about 10 packets of 10 contacts before the timeout.

    As expected from that, I can see about 100 contacts in the phones address book.

    But DAVdtroid still tries to download all 229 contacts. - The number is never decreasing.


  • developer

    @hey Could you please provide the logs?



  • I could not find a tool to remove sensible information from the log. But the beginning of the log shows that all local entries get deleted - sorry, missed that before:

    I/davdroid(18713): [syncadapter.SyncAdapterService$SyncAdapter] Sync for com.android.contacts has been initiated
    I/davdroid(18713): [syncadapter.SyncAdapterService$SyncAdapter] Sync for com.android.calendar has been initiated
    I/davdroid(18713): [AccountSettings] Account horst@freedict.de has version 4, current version: 4
    I/davdroid(18713): [AccountSettings] Account horst@freedict.de has version 4, current version: 4
    I/davdroid(18713): [AccountSettings] Account horst@freedict.de has version 4, current version: 4
    I/davdroid(18713): [syncadapter.SyncManager] Preparing synchronization
    I/davdroid(18713): [syncadapter.ContactsSyncManager] Selected address book has changed from null to https://<..nextcloudadress...>/contacts/, deleting all local contacts
    I/davdroid(18713): [syncadapter.CalendarsSyncAdapterService$SyncAdapter] Calendar sync complete
    I/davdroid(18713): [syncadapter.SyncAdapterService$SyncAdapter] Sync for org.dmfs.tasks has been initiated
    I/davdroid(18713): [AccountSettings] Account horst@freedict.de has version 4, current version: 4
    I/davdroid(18713): [syncadapter.TasksSyncAdapterService$SyncAdapter] Task sync complete
    I/davdroid(18713): [syncadapter.SyncManager] Querying capabilities
    I/davdroid(18713): [syncadapter.ContactsSyncManager] Server advertises VCard/4 support: true
    I/davdroid(18713): [syncadapter.ContactsSyncManager] Contact group method: CATEGORIES
    I/davdroid(18713): [syncadapter.SyncManager] Processing locally deleted entries
    I/davdroid(18713): [syncadapter.SyncManager] Locally preparing dirty entries
    I/davdroid(18713): [syncadapter.SyncManager] Looking for contacts/groups without file name
    I/davdroid(18713): [syncadapter.SyncManager] Uploading dirty entries
    I/davdroid(18713): [syncadapter.SyncManager] Checking sync state
    I/davdroid(18713): [syncadapter.SyncManager] Manual sync, ignoring CTag
    I/davdroid(18713): [syncadapter.SyncManager] Listing local entries
    I/davdroid(18713): [syncadapter.SyncManager] Listing remote entries
    I/davdroid(18713): [syncadapter.SyncManager] Comparing local/remote entries
    

  • developer

    I could not find a tool to remove sensible information from the log. But the beginning of the log shows that all local entries get deleted - sorry, missed that before:

    Probably because there wasn't a successful sync yet. Not the most ideal solution, will think about that.

    However, the real problem still remains the server timeout… and without logs, I can't say anything more.


  • developer

    The problem that contacts are deleted again and again until there is a successful sync has been fixed in davdroid/ef92753a.

    Maybe this could help you, but the timeout will probably still be the main problem.



  • Thanks a lot - the sync behavior is much better now.

    After a couple of sync processes only a remainder of 7 contacts fail to sync. - the other contacts remain on the phone.
    Could it have something to do with the contacts?
    The link addresses from the log file work fine when I do open them in firefox.

    12-19 21:12:29.176 11849-30099/at.bitfire.davdroid:sync I/davdroid: [syncadapter.ContactsSyncManager] Downloading 7 contacts (10 at once) 
    12-19 21:12:29.177 11849-30099/at.bitfire.davdroid:sync I/davdroid: [syncadapter.ContactsSyncManager] Downloading <address> 17b7-40db-b485-44b63a405cff.vcf, <address>d02f-4bf8-b1f0-c826a12e1446.vcf, <address>7daf-4097-9b95-125fb9625b4d.vcf, <address>256A677E-5F6F88CE.vcf, <address>1755-4e62-ae21-52406896a863.vcf, <address>4f49-b1db-fb1b9d581cdf.vcf, <address>0364-4e68-bfc4-374089d492a3.vcf
    12-19 21:12:44.550 11849-11866/at.bitfire.davdroid:sync W/art: Suspending all threads took: 18.278ms
    12-19 21:12:59.060 11849-11866/at.bitfire.davdroid:sync W/art: Suspending all threads took: 23.914ms
    12-19 21:13:47.559 11849-11866/at.bitfire.davdroid:sync W/art: Suspending all threads took: 5.277ms
    12-19 21:13:52.061 11849-11866/at.bitfire.davdroid:sync W/art: Suspending all threads took: 7.325ms
    12-19 21:14:29.185 11849-30099/at.bitfire.davdroid:sync W/davdroid: [syncadapter.SyncManager] I/O exception during sync, trying again later
                                                                        EXCEPTION java.net.SocketTimeoutException: timeout
                                                                            at okio.Okio$4.newTimeoutException(Okio.java:227)
                                                                            at okio.AsyncTimeout.exit(AsyncTimeout.java:274)
                                                                            at okio.AsyncTimeout$2.read(AsyncTimeout.java:242)
                                                                            at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325)
                                                                            at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314)
                                                                            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
                                                                            at okhttp3.internal.http1.Http1Codec.readResponse(Http1Codec.java:191)
                                                                            at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:132)
                                                                            at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:54)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at at.bitfire.dav4android.BasicDigestAuthHandler.intercept(BasicDigestAuthHandler.java:290)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at at.bitfire.davdroid.HttpClient$UserAgentInterceptor.intercept(HttpClient.java:164)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                            at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
                                                                            at okhttp3.RealCall.execute(RealCall.java:63)
                                                                            at at.bitfire.dav4android.DavAddressBook.multiget(DavAddressBook.java:111)
                                                                            at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(ContactsSyncManager.java:327)
                                                                            at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:170)
                                                                            at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.onPerformSync(ContactsSyncAdapterService.java:66)
                                                                            at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
    12-19 21:14:29.186 11849-30099/at.bitfire.davdroid:sync I/davdroid: [syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter] Address book sync complete
    12-19 21:16:29.431 11849-11866/at.bitfire.davdroid:sync W/art: Suspending all threads took: 8.461ms
    

  • developer

    @hey said in Sync fails with Nextcloud:

    After a couple of sync processes only a remainder of 7 contacts fail to sync. - the other contacts remain on the phone.
    Could it have something to do with the contacts?
    The link addresses from the log file work fine when I do open them in firefox.

    With Firefox, you can only do a GET request for every single VCard. DAVdroid uses addressbook-multiget to download the 7 contacts at once.

    As I said above, I don't see any indication that this could be a DAVdroid problem. Did you have a look at the server/Nextcloud logs?



  • Hi,

    it took a while for me to find out what is going on. - I finally managed to sync all my contacts, so I wanted to share what is going on.

    First I hacked the code to just synchronize one contact at a time. It turned out that only one contact gave problems in the end.

    I had a look at that contact. It had a large contact picture (2MByte), and it took a long time for the server to reply. (> 60 sec?)

    After deleting the picture (and replacing it with a smaller one) I can sync all my contacts without problems.

    Thanks for DAVdroid
    & merry x-mas


  • admin

    Thank you for the update on this and also for the clarification – hopefully it helps other people that run into same issues :-)



Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.