monicahq / monica

Personal CRM. Remember everything about your friends, family and business relationships.
https://beta.monicahq.com
GNU Affero General Public License v3.0
21.67k stars 2.17k forks source link

Contact sync with DavX fails with HTTP 500 #6317

Open justsomebody42 opened 2 years ago

justsomebody42 commented 2 years ago

Describe the bug I have a fully working installation hosted within Kubernetes. It's a new installation running on 3.7.0 and I did an SQL import of the data I had in my old installation (which was updated 3.7.0 as well...). Contact syncing works fine, but recently one of the contacts I updated on my phone starts to produce an HTTP 500, when DavX tries to sync. Unfortunately, this happens regularly and is quite anoying.

The debug output of DavX reveals an issue when sabredav tries to parse the data. I'm using the Samsung contacts app on an S21.

Is there anything I can do to fix this? Or is it a bug in sabredav? Or a bug in the Samsung contacts app that's providing corrupt data?

Any help is appreciated!

--- BEGIN DEBUG INFO ---

SYNCHRONIZATION INFO
Account: Account {name=Kontakte (Monica (Kube) NQ), type=at.bitfire.davdroid.address_book}
Authority: com.android.contacts

EXCEPTION
at.bitfire.dav4jvm.exception.HttpException: HTTP 500 
    at at.bitfire.dav4jvm.DavResource.checkStatus(DavResource.kt:5)
    at at.bitfire.dav4jvm.DavResource.checkStatus(DavResource.kt:3)
    at at.bitfire.dav4jvm.DavResource.put(DavResource.kt:2)
    at at.bitfire.dav4jvm.DavResource.put$default(DavResource.kt:1)
    at at.bitfire.davdroid.syncadapter.SyncManager$uploadDirty$3.invoke(SyncManager.kt:5)
    at at.bitfire.davdroid.syncadapter.SyncManager$uploadDirty$3.invoke(SyncManager.kt:1)
    at at.bitfire.davdroid.syncadapter.SyncManager.remoteExceptionContext(SyncManager.kt:1)
    at at.bitfire.davdroid.syncadapter.SyncManager.uploadDirty(SyncManager.kt:16)
    at at.bitfire.davdroid.syncadapter.SyncManager$uploadDirty$1$1$1.invoke(SyncManager.kt:2)
    at at.bitfire.davdroid.syncadapter.SyncManager$uploadDirty$1$1$1.invoke(SyncManager.kt:1)
    at at.bitfire.davdroid.syncadapter.SyncManager.localExceptionContext(SyncManager.kt:1)
    at at.bitfire.davdroid.syncadapter.SyncManager$uploadDirty$1$1.invokeSuspend(SyncManager.kt:2)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)

HTTP REQUEST
Request{method=PUT, url=https://monica.../dav/addressbooks/.../contacts/975d4a...83-d9f9d72770f7.vcf, headers=[If-Match:"7e960f144582a4fe1826a39bcc1b6abb1bc36219", Accept-Encoding:br,gzip]}
BEGIN:VCARD
VERSION:4.0
PRODID:+//IDN bitfire.at//DAVx5/3.3.12-ose ez-vcard/0.11.2
GENDER:F
UID:975d4aee-5c5a-45f4-a383-d9f9d72770f7
FN:...
N:...
TEL:...
TEL;TYPE=cell:...
EMAIL:...
BDAY:...
PHOTO:data:image/jpeg;base64,/9j/4...Gx+S//2Q==
REV:...
END:VCARD

HTTP RESPONSE
Response{protocol=h2, code=500, message=, url=https://monica..../dav/addressbooks/.../contacts/975d4aee-5c5...72770f7.vcf}
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:sabredav-version>4.3.1</s:sabredav-version>
  <s:exception>Illuminate\Validation\ValidationException</s:exception>
  <s:message>The given data was invalid.</s:message>
</d:error>

LOCAL RESOURCE
at.bitfire.davdroid.resource.LocalContact@7d8c1f1[cache-a383-d9f9d72770f7...,unknownProperties=BEGIN:VCARD
VERSION:4.0
PRODID:ez-vcard 0.11.2
GENDER:F
END:VCARD
,urls=[]],eTag=7e960f144582a4fe1826a39bcc1b6abb1bc36219,fileName=975d4aee-5...3-d9f9d72770f7.vcf,id=4139]

REMOTE RESOURCE
https://monica..../dav/addressbooks/.../contacts/975d4aee-5c5a...d9f9d72770f7.vcf

SOFTWARE INFORMATION

┌────────────────────────────────────────┬─────────────────────────────────────────────────────────┬────────────┬─────────────────────────────────────┬──────────┐
│ Package                                │ Version                                                 │ Code       │ Installer                           │ Notes    │
├────────────────────────────────────────┼─────────────────────────────────────────────────────────┼────────────┼─────────────────────────────────────┼──────────┤
│ at.bitfire.davdroid                    │ 3.3.12-ose                                              │ 303120005  │ com.google.android.packageinstaller │          │
│ com.samsung.android.providers.contacts │ 13.1.16                                                 │ 1311604000 │ —                                   │          │
│ com.android.providers.calendar         │ 12.3.00.10                                              │ 1230000010 │ —                                   │          │
│ com.samsung.android.calendar           │ 12.3.06.1000                                            │ 1230601000 │ —                                   │          │
│ com.microsoft.office.outlook           │ 4.2230.1                                                │ 42230810   │ com.android.vending                 │ disabled │
│ fm.player                              │ 5.3.4                                                   │ 27745      │ com.android.vending                 │ disabled │
│ com.google.android.apps.messaging      │ messages.android_20220524_00_RC01.phone_samsung_dynamic │ 131485900  │ com.android.vending                 │ disabled │
└────────────────────────────────────────┴─────────────────────────────────────────────────────────┴────────────┴─────────────────────────────────────┴──────────┘

SYSTEM INFORMATION

Android version: 12 (SP1A.210812.016.G996BXXU5CVH7)
Device: samsung SM-G996B (t2s)
Locale(s): [de_DE]
justsomebody42 commented 2 years ago

Updating the contact on the server fixed the issue, so I got rid of the HTTP 500 for now, but would still be curious, if this is something that could be addressed or might happen in the future again.

mptpro commented 3 weeks ago

I am having the same issue - how did you figure out which contact is causing the issue?

thanks

justsomebody42 commented 3 weeks ago

Haven't seen the issue in quite a while, but you should be able to identify the contact with the URL given in the debug info.