calContacts critical SIGABRT error on 1 Gmail account (others are ok)

Description

Suddenly one Gmail account, from the 4 accounts configured, started to show an connection error on the app: “Encountered an error while syncing username@gmail.com”.
The Gmail account works well from the Gmail web app. All the other 3 gmail accounts are working well on Mailspring.
I’ve uninstalled Mailspring and deleted all data, tested from snap and from deb installer, and the behavior is the same: all the accounts are working well but this account keep showing the error.
After “Try again”, the app works well until some time (from seconds to a few minutes) it gets the error again.

To Reproduce…

Steps to reproduce the behavior:

  1. Install Mailspring (snap or deb).
  2. Configure 2 gmail accounts: the one with the problem and other one.
  3. Wait a couple of minutes.
  4. Sync error.

Expected Behavior

Sync without errors like the other accounts.

Screenshots

Setup

  • OS and Version: Ubuntu Linux 22.10
    • Installation Method: snapcraft (actual). Also tried .deb
  • Mailspring Version: 1.10.7-5008ecc3

Additional Context

Code from /Preferences/Accounts/Error Details:

Mailspring Version: 1.10.7-5008ecc3
Platform: linux
Account State: sync_error
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com
--------------------------------------------
52105 [2022-12-01 15:23:35.266] [metadata] [info] Metadata delta stream starting...
52105 [2022-12-01 15:23:39.266] [background] [info] Fetching XOAuth2 access token (gmail) for ab1c444e
52105 [2022-12-01 15:23:39.411] [background] [info] Marking all folders as `busy`
52105 [2022-12-01 15:23:39.414] [background] [info] Syncing folder list...
52105 [2022-12-01 15:23:39.982] [background] [info] Syncing folder list...
52105 [2022-12-01 15:23:40.337] [background] [info] Sync loop deleting unlinked messages with phase 2.
52105 [2022-12-01 15:23:40.367] [background] [info] Sync loop complete.
52105 [2022-12-01 15:23:40.428] [foreground] [info] syncFolderChangesViaCondstore - [Gmail]/Todos: modseq 13079747 to 13079747, uidnext 217483 to 217483
52105 [2022-12-01 15:23:40.553] [foreground] [info] Idling on folder [Gmail]/Todos
52105 [2022-12-01 15:23:50.265] [metadataExpiration] [info] Scanning for expired metadata
52105 [2022-12-01 15:23:50.266] [metadataExpiration] [info] -- Sending expiration event for Message HUxWXfXs5o5hphYRHXSZ4eD4cUNCr7jTcCCPdSeKx
52105 [2022-12-01 15:23:50.267] [metadataExpiration] [info] -- Will wake for next expiration in 7200sec
52105 [2022-12-01 15:24:00.037] [calContacts] [critical] 
***
*** Mailspring Sync 
*** An abort error (SIGABRT) occurred during program execution: 
*** system functions that detect corrupt state.
***

52568 [2022-12-01 15:24:00.179] [main] [info] Identity created at 1569243608 - using ID Schema 1
52568 [2022-12-01 15:24:00.180] [main] [info] ------------- Starting Sync (username@gmail.com) ---------------
52568 [2022-12-01 15:24:00.184] [metadata] [info] Metadata delta stream starting...
52568 [2022-12-01 15:24:04.184] [background] [info] Fetching XOAuth2 access token (gmail) for ab1c444e
52568 [2022-12-01 15:24:04.317] [background] [info] Marking all folders as `busy`
52568 [2022-12-01 15:24:04.320] [background] [info] Syncing folder list...
52568 [2022-12-01 15:24:04.899] [background] [info] Syncing folder list...
52568 [2022-12-01 15:24:05.268] [background] [info] Sync loop deleting unlinked messages with phase 2.
52568 [2022-12-01 15:24:05.299] [background] [info] Sync loop complete.
52568 [2022-12-01 15:24:05.471] [foreground] [info] syncFolderChangesViaCondstore - [Gmail]/Todos: modseq 13079747 to 13079747, uidnext 217483 to 217483
52568 [2022-12-01 15:24:05.615] [foreground] [info] Idling on folder [Gmail]/Todos
52568 [2022-12-01 15:24:15.184] [metadataExpiration] [info] Scanning for expired metadata
52568 [2022-12-01 15:24:15.185] [metadataExpiration] [info] -- Sending expiration event for Message HUxWXfXs5o5hphYRHXSZ4eD4cUNCr7jTcCCPdSeKx
52568 [2022-12-01 15:24:15.185] [metadataExpiration] [info] -- Will wake for next expiration in 7200sec
52568 [2022-12-01 15:24:25.087] [calContacts] [critical] 
***
*** Mailspring Sync 
*** An abort error (SIGABRT) occurred during program execution: 
*** system functions that detect corrupt state.
***

All the time the error repeats the same pattern:

[calContacts] [critical] 
***
*** Mailspring Sync 
*** An abort error (SIGABRT) occurred during program execution: 
*** system functions that detect corrupt state.
***

I tried to run with Debug Flags, but Mailspring stop working.

At this point I can’t find the source of the problem: is it a contact, a calendar element or an email? Is there any way to get more detail about what is causing this error? Is an error related to the SO? (This happens in a new laptop with the last Ubuntu version 22.10).

Tested the same configuration on Ubuntu 22.04 and Ubuntu 22.10:

  • Ubuntu 22.04: it works!
  • Ubuntu 22.10: it fails!

This bug is system related to Ubuntu 22.10, but only affects to 1 particular gmail account. This account has several (thousandths?) of emails, calendar entries, and contacts. The other not affected gmail accounts only has hundreds of email, with no calendar entries, nor contacts.

Well something happens about this, because it keeps repeating before the error:

... [metadataExpiration] [info] -- Sending expiration event for Message HUxWXfXs5o5hphYRHXSZ4eD4cUNCr7jTcCCPdSeKx

By now I have no idea how to find this element on mailspring or gmail.

I don’t know why this is failing on Ubuntu 22.10 but it works on Ubuntu 22.04. Same Mailspring version 1.10.7 from snap.

…Mmm… not sure about the problem is just an element. I’m doing a recreate cache action and having several error without any element related.

More data from Toggle Developer Tools/Console:

-1669935202205.log (69.2 KB)

The account with problems is the ab1c444e one.

Some debug done.

Now I can see that this problem is only affecting to me, but it can affect others.

It keeps falling into “Encountered an error while syncing …" after getting this in the logs:

1694331 [2022-12-12 16:20:57.674] [metadataExpiration] [info] Scanning for expired metadata
1694331 [2022-12-12 16:20:57.675] [metadataExpiration] [info] -- Sending expiration event for Message HUxWXfXs5o5hphYRHXSZ4eD4cUNCr7jTcCCPdSeKx
1694331 [2022-12-12 16:20:57.675] [metadataExpiration] [info] -- Will wake for next expiration in 7200sec
1694331 [2022-12-12 16:21:07.583] [calContacts] [critical] 
***
*** Mailspring Sync 
*** An abort error (SIGABRT) occurred during program execution: 
*** system functions that detect corrupt state.
***

I’m working on a debug plugin where I was able to identify the message with the ID = HUxWXfXs5o5hphYRHXSZ4eD4cUNCr7jTcCCPdSeKx. The message appears to be ok in Gmail, but it has problems in Mailspring.

Looking into the details of the message in mailspring, I can see this:

    "metadata": [
        {
            "pluginId": "open-tracking",
            "v": 0,
            "value": {
                "open_count": 0,
                "open_data": [],
                "uid": "4243E6E5-7FDC-45A7-9468-66A6807FCF85@getmailspring.com"
            },
            "__cls": "PluginMetadata"
        },
        {
            "pluginId": "send-later",
            "v": 0,
            "value": {
                "expiration": null
            },
            "__cls": "PluginMetadata"
        },
        {
            "pluginId": "send-reminders",
            "v": 0,
            "value": {
                "expiration": 1657295465,
                "sentHeaderMessageId": "4243E6E5-7FDC-45A7-9468-66A6807FCF85@getmailspring.com"
            },
            "__cls": "PluginMetadata"
        }
    ],

This metadata doesn’t come from Gmail but it seems to come from the Mailspring Account (I’m using it!).

Maybe the "expiration": 1657295465 value can be the problem.

The next step is to try to understand how to get and modify this metadata over the message and, hopefully, over the Mailspring Account (server).

Any help is welcome!

Not sure it this will help… but here we go.

The metadata should be stored in the local DB edgehill.db. You can access it with a DB management app, like DB Browser for SQLite.

You can load the DB file (above) and explore the data under the “Browse Data” tab. There is a table called ModelPluginMetadata; from there you can filter, if necessary, edit the expiry date and then “Write Changes”. I’d recommend doing it while mailspring isn’t running.

Not sure where it is in Ubuntu. But, in Windows, it’s in the same place as when you click the below button in your preferences

Thank you for your reply, but it seems that the problem is another one, so all the debug done is for nothing.

Anyway, more debug and tests.

I ended with a fresh start (removing the ~/.config/Mailspring directory), skipping the Mailspring ID login and configuring the problematic Gmail account (with access to emails, contacts, and calendars, as always).

After that the error was there again. This was very annoying because there was no connection with the Mailspring servers so the metadata is not used. This removes the metadata hypothesis.

Then click on “retry” and it was working well for a while, without errors.

After checking that everything seems to be good, I quit the app and wait for all sub-processes to end. After opening the app again, the error is back!

Checking more on the error logs, I found this info inside these files:

config.json:

Error: nullmailsync.bin: /home/travis/build/Foundry376/Mailspring-Sync/Vendor/nlohmann/json.hpp:17760: 
const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::operator[](T*) 
const [with T = const char;
ObjectType = std::map;
ArrayType = std::vector;
StringType = std::__cxx11::basic_string<char>;
BooleanType = bool;
NumberIntegerType = long int;
NumberUnsignedType = long unsigned int;
NumberFloatType = double;
AllocatorType = std::allocator;
JSONSerializer = nlohmann::adl_serializer;
nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference = const nlohmann::basic_json<>&;
nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::value_type = nlohmann::basic_json<>]: Assertion `m_value.object->find(key) != m_value.object->end()' failed.
98525 [2022-12-13 16:40:10.710] [calContacts] [critical] 
***
*** Mailspring Sync 
*** An abort error (SIGABRT) occurred during program execution: 
*** system functions that detect corrupt state.
***

kern.log:

Dec 13 16:33:56 Han kernel: [14021.804288] background[91990]: segfault at 244 ip 0000000000f530d9 sp 00007fc57edfce90 error 4 in mailsync.bin[400000+2972000]
Dec 13 16:33:56 Han kernel: [14021.804335] Code: 00 00 00 00 e9 bc fb ff ff 0f 1f 84 00 00 00 00 00 5b c3 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 48 83 ec 08 e8 27 ed ff ff <8b> 90 44 02 00 00 3b 90 40 02 00 00 74 29 83 c2 01 89 d1 c1 f9 1f

apport.log:

ERROR: apport (pid 98974) Tue Dec 13 16:40:10 2022: called for pid 98525, signal 6, core limit 0, dump mode 1
ERROR: apport (pid 98974) Tue Dec 13 16:40:10 2022: executable: /usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin (command line "/usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin --mode sync --info username@gmail.com")
ERROR: apport (pid 98974) Tue Dec 13 16:40:10 2022: is_closing_session(): no DBUS_SESSION_BUS_ADDRESS in environment
ERROR: apport (pid 98974) Tue Dec 13 16:40:10 2022: this executable already crashed 2 times, ignoring

I attach the complete logs.

Any idea how to debug or get more info about what is going on with this Gmail account?

mailsync-ab1c444e.log (84.3 KB)
apport.log (7.8 KB)

Same problem on:

  • Ubuntu 22.10 - deb package
  • Ubuntu 22.04 - snap

Mailspring Version: 1.10.7-5008ecc3
Platform: linux
Account State: sync_error
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com

More tests done!

It seems that I found a workaround, but not a solution.

Tests done

Durting Mailspring setup, you are asked to login into 2 different accounts:

  • Mailspring ID
  • Gmail Account

During the Gmail authentification, this service ask for which kind of service is Mailspring going to be allow:

  • email
  • contacts
  • calendar

As always, I ended marking the 3 options. But after the problems with this one account (the other 3 accounts are working well) I started to think that maybe something could be wrong.

In each test the whole data directory ( ~/.config/Mailspring) was deleted and Mailspring was configured from zero:

mailspring id email contacts calendar result
test 01 x x x x error
test 02 x x x error
test 03 x ok
test 04 x x error
test 05 x x ok
test 06 x x ok

As can be seen, something is wrong with the contacts, but if I don’t allow access to Mailspring to the contacts, everything seems to work well.

Work to be done

It’s clear that something happens with one or many contacts in this one account, but right now I have no idea about how to find were the problem is or how to debug it.

Any idea or suggestion is welcome!

Workaround (not a solution)

When configuring the access to the Gmail account, do not allow access to contacts.

1 Like

I can confirm that the workaround works. I am still waiting for a solution. THX!