Contacts: Certain details (e.g. addresses) are not syncing between phone and server

Created on 18 Jun 2020  Â·  10Comments  Â·  Source: nextcloud/contacts

Steps to reproduce

  1. Have your contacts synched between Nextcloud Server and your Android phone using DAVx5 (I use 'Version 3.1.1-gplay (301010002)'). Make sure that if you create a new contact on the server that it appears on your phone after a sync.
  2. On the server (through the web interface) change the address of a contact and make sure that it is saved.

Expected behaviour

It is expected that the change is propagated to the phone after a sync by DAVx5.

Actual behaviour

The change is not propagated to the phone. There is now a situation where the address on the server and the address on the phone are different for a particular contact. Even after a sync.

Server configuration detail

Operating system: Linux 4.15.0-106-generic #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020 x86_64

Webserver: nginx/1.14.0 (fpm-fcgi)

Database: mysql 5.7.30

PHP version:

7.2.24-0ubuntu0.18.04.6
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imagick, intl, json, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache

Nextcloud version: 18.0.6 - 18.0.6.0

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: unknown

Signing status

Array
(
)

List of activated apps

Enabled:
 - activity: 2.11.0
 - bruteforcesettings: 1.6.0
 - calendar: 2.0.3
 - cloud_federation_api: 1.1.0
 - contacts: 3.3.0
 - dav: 1.14.0
 - deck: 1.0.2
 - federatedfilesharing: 1.8.0
 - files: 1.13.1
 - files_pdfviewer: 1.7.0
 - files_rightclick: 0.15.2
 - files_sharing: 1.10.1
 - files_trashbin: 1.8.0
 - files_versions: 1.11.0
 - files_videoplayer: 1.7.0
 - issuetemplate: 0.6.0
 - logreader: 2.3.0
 - lookup_server_connector: 1.6.0
 - nextcloud_announcements: 1.7.0
 - notes: 3.5.1
 - notifications: 2.6.0
 - oauth2: 1.6.0
 - password_policy: 1.8.0
 - photos: 1.0.0
 - privacy: 1.2.0
 - provisioning_api: 1.8.0
 - serverinfo: 1.8.0
 - settings: 1.0.0
 - sharebymail: 1.8.0
 - text: 2.0.0
 - theming: 1.9.0
 - twofactor_backupcodes: 1.7.0
 - twofactor_totp: 4.1.3
 - twofactor_u2f: 5.1.0
 - updatenotification: 1.8.0
 - viewer: 1.2.0
 - workflowengine: 2.0.0
Disabled:
 - accessibility
 - admin_audit
 - comments
 - encryption
 - federation
 - files_external
 - firstrunwizard
 - recommendations
 - support
 - survey_client
 - systemtags
 - user_ldap

Configuration (config/config.php)

{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "files.enhancedstrategy.com"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "18.0.6.0",
    "overwrite.cli.url": "https:\/\/files.enhancedstrategy.com",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "memcache.local": "\\OC\\Memcache\\APCu",
    "mail_smtpmode": "smtp",
    "mail_smtpsecure": "tls",
    "mail_sendmailmode": "smtp",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpauthtype": "LOGIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "587",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "twofactor_enforced": "true",
    "twofactor_enforced_groups": [],
    "twofactor_enforced_excluded_groups": [],
    "maintenance": false,
    "simpleSignUpLink.shown": false,
    "loglevel": 2
}

Are you using external storage, if yes which one: No

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0

Operating system:

Logs

Web server error log

n/a

Nextcloud log

n/a

Browser log

n/a

0. Needs triage bug

Most helpful comment

Thanks for the clarification and the logs! The DAVx5 logs show this vCard which is received by DAVx5 when the first problem (NewAddress2AfterChangeOnPhone not coming through) occurs:

…
ADR;TYPE=work;LABEL="Haarlemmerplein 10, 1013 HS Amsterdam, Netherlands":;;
 NewAdressAfterChangeOnPhone 2;NewCityAfterChangeOnPhone;;3333 GG;
…

As you can see, the LABEL is still "Haarlemmerplein 10…", which is then inserted into the Android database as FORMATTED_ADDRESS (data1):

2020-07-16 13:02:25 81797 [AndroidContact] Built StructuredPostal data row
PARAMETER #0 = mType: 1, mUri: content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contacts%20(nextcloud%40domain.tld%20nA)&account_type=at.bitfire.davdroid.address_book, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=2462 data9=3333 GG data8=null data7=NewCityAfterChangeOnPhone data6=null data5=null data4=NewAdressAfterChangeOnPhone 2 data3=null data2=2 data1=Haarlemmerplein 10, 1013 HS Amsterdam, Netherlands data10=null mimetype=vnd.android.cursor.item/postal-address_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null

I think that all problems/misunderstandings have their origin in the diverging contents of ADR and its LABEL. Maybe Nextcloud Contacts could

  1. either update/regenerate the LABEL parameter on address updates or
  2. drop the LABEL, if it can't understand/update it; and
  3. maybe show the LABEL as an extra field? Something like "Formatted address" (should be an optional multi-line field).

Or maybe DAVx5 should send no LABEL at all? However, Android has this FORMATTED_ADDRESS field, and I have mapped it to the adr-label, because for me it seems to be useful for this purpose.

All 10 comments

cc @rfc2822 :)
How can we help debugging this?

(And hope you're doing ok over there, long time no see! :wave: :hugs:)

Sounds like an inconsistency between LABEL and ADR.

What are "certain details (e.g. addresses)"? The report is only about addresses. What are the other details? Are there steps to reproduce the problem?

DAVx5 debug logs (verbose logging) should contain all information required to debug that.

Apologies for the lack of clarity. I am now using a regular version of Android and am really disliking Google's contacts app which does all sort of things without me necessarily wanting it (or being clear about it).

The report is about addresses, because I know for sure they were giving a problem. But I also had a problem with a name update, but didn't dig further into it.

Both the name field and the address field share this (to me) weird phenomenon where you can either store the data in a single field (i.e. firstname and surname in one field) or you can store it in multiple fields (i.e. by filling in a detailed name as Nextcloud calls it). Google wants to store an address in a single field as a string (and autocompletes it for you in their contacts app), whereas Nextcloud prefers to spread an address out over multiple fields.

I've done some extra testing with verbose logging to help with the debugging. What I have done is the following:

  • Checked if there was an update for DAVx5 (there wasn't, so am using version '3.2.1.1-gplay (302010100)').
  • Set the sync frequency of the 'Contacts sync. interval' of my Nextcloud account in DAVx5 to 'Only manually', and (for privacy reasons) turnen off the syncing of my calendars.
  • Turned on verbose logging
  • Created a new contact on the Nextcloud server using the standard web interface and filled quite a few details:

before-change

  • I then did a manual sync via DAVx5. The contact came through as expected.
  • I next changed all the details of the contact on the server side:

after-first-change

  • I synced DAVx5 and The changes came through on my phone as expected.
  • I then only changed the address on the server side and synced. This worked fine too.
  • I then changed the contact on my phone and used Google's way to find an address. Google stored this in a single field.
  • I synced with DAVx5 and the results came through on the server side:

after-change-on-phone-to-google-address

  • There is one small problem though with Nextcloud (I guess?) adding a slash right after the city and before the comma (or maybe forgetting to strip a slash). Do let me know if I should create a separate issue for this.

extra-slash

  • I also got this message ‘This contact was broken and received a fix. Please review the content and click here to save it.’ Not sure why that happens and not the most usefu message, but I clicked.
  • I then only changed the address on the server side:

another-change

  • After a DAVx5 sync I could not see the change on my phone:

change-not-coming-true

  • However when I clicked edit, I could see that some of the changes did come through although they were not shown when displaying the contact (city and Zip Code), but not the street:

some-changes-are-there

  • I saved the DAVx5 log.

I am not comfortable with sharing my logfiles here on GitHub (for eternity), but you can download a ZIP-file with 'davx5-log.txt' and 'davx5-info.txt' via the following URL (within a week):

_Removed as the logs have already been used_

Does this help you in seeing where the problem may be? Please tell me if you need anything else. I am not a programmer, just an enthusiastic user, so not very fluent in how things are done here on GitHub.

Thanks for the clarification and the logs! The DAVx5 logs show this vCard which is received by DAVx5 when the first problem (NewAddress2AfterChangeOnPhone not coming through) occurs:

…
ADR;TYPE=work;LABEL="Haarlemmerplein 10, 1013 HS Amsterdam, Netherlands":;;
 NewAdressAfterChangeOnPhone 2;NewCityAfterChangeOnPhone;;3333 GG;
…

As you can see, the LABEL is still "Haarlemmerplein 10…", which is then inserted into the Android database as FORMATTED_ADDRESS (data1):

2020-07-16 13:02:25 81797 [AndroidContact] Built StructuredPostal data row
PARAMETER #0 = mType: 1, mUri: content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contacts%20(nextcloud%40domain.tld%20nA)&account_type=at.bitfire.davdroid.address_book, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=2462 data9=3333 GG data8=null data7=NewCityAfterChangeOnPhone data6=null data5=null data4=NewAdressAfterChangeOnPhone 2 data3=null data2=2 data1=Haarlemmerplein 10, 1013 HS Amsterdam, Netherlands data10=null mimetype=vnd.android.cursor.item/postal-address_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null

I think that all problems/misunderstandings have their origin in the diverging contents of ADR and its LABEL. Maybe Nextcloud Contacts could

  1. either update/regenerate the LABEL parameter on address updates or
  2. drop the LABEL, if it can't understand/update it; and
  3. maybe show the LABEL as an extra field? Something like "Formatted address" (should be an optional multi-line field).

Or maybe DAVx5 should send no LABEL at all? However, Android has this FORMATTED_ADDRESS field, and I have mapped it to the adr-label, because for me it seems to be useful for this purpose.

Would it be possible for you take out my email address from the quotes log file (i.e. my account name)?

of course

Experienced the same behaviour while dealing with #1749

Hi,
this bug is very annoying. Would be nice to get it solved somehow...

Thanx!

I have experienced the same issue. When I edit the address of a contact using the web interface, it is not synced to my Android phone. Nextcloud Contacts 3.4.2, DAVx5 3.3.8-ose.
Is there a workaround maybe?
Edit: When I add a second address it gets synced properly. So my workaround for now is to not edit address fields but add the modified address as a new field. Then delete the old address later.

Experiencing the same issue. Other fields except the address are synchronized properly. I'm using the same workaround as oncer described. Is there a fix to this problem?

Was this page helpful?
0 / 5 - 0 ratings