Closed Bug 1653234 Opened 2 years ago Closed 2 years ago

After updating to TB 78 beta, all contacts appear lost (entire address book empty/blank/not showing)

Categories

(Thunderbird :: Address Book, defect, P1)

Tracking

(thunderbird_esr68-, thunderbird_esr78+ fixed, thunderbird79 fixed)

RESOLVED FIXED
Thunderbird 80.0
Tracking Status
thunderbird_esr68 - ---
thunderbird_esr78 + fixed
thunderbird79 --- fixed

People

(Reporter: anjeyelf, Assigned: mkmelin)

References

(Blocks 1 open bug, )

Details

(Keywords: dataloss)

Attachments

(5 files, 6 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

Creating a new bug report after seeing support forum question.
https://support.mozilla.org/en-US/questions/1295073
Quote:

I was at 77.0b3 when 78 beta was installed.
OS is Win 7 64 home premium, with all and final updates.

Actual results:

I lost all of the data in my address book.
I downgraded (from archived copy) to previous version, exported address book as ldif file, upgraded to 78 and imported address book only to have it empty again. Seemed all was successful, but the address book was still empty. Opening the address book I had nothing showing. Composing and email, in the past if i put a few letters in it would pull in the entry. After the change and import there was nothing coming up when I started typing letters of a known past contact.
I have tried most recent beta 4 with same results.

Expected results:

Address books should be available.

Component: Untriaged → Address Book
Keywords: dataloss
Blocks: tb78found
See Also: → 1653558

In your support post you say that contacts still appear when composing email, is that correct? So the issue would be that the address book window doesn't display them, not that they don't exist?

I'd like to know what (if any) messages appear on the Error Console when opening the address book window. Some changes did happen there in 77 and in 78 which could conceivably have caused this.

Flags: needinfo?(anjeyelf)

Person said : after the update to 78 address book was empty and (attempt to import address book again failed ) there was nothing coming up when I started typing letters of a known past contact.
So no address books, no auto compelete, nothing in Contacts sidebar.

When adviced to retry renaming the .bak file:
"I tried renaming the .bak file, but after opening it was blank. I also copied the abook.sqlite file from my backup into 78b4 and again blank."

I'll ask person about error console and report back.

It really looks like 78 was released way too early. What was all the sudden rush to push it out?

Flags: needinfo?(anjeyelf)

My experience with my failed upgrade and subsequent return was that abook and history made it into the address book on downgrade after renaming all of the .bak files, but none of the others appeared other than the windows contacts that I had enabled years ago through prefs. My assumption was the pointer in prefs.js was rewritten in the upgrade to the SQLite version.

Starting to get more complaints on lost address books - no contacts - no autofill etc
https://support.mozilla.org/en-US/questions/1295666

(In reply to Anje from comment #5)

Starting to get more complaints on lost address books - no contacts - no autofill etc
https://support.mozilla.org/en-US/questions/1295666

That's they guy from https://support.mozilla.org/en-US/questions/1295662 who also started in safe mode

Severity: -- → S1
Priority: -- → P1

But he has all the same issues. If no address book then much of the header info goes as well. Sounds same as bug 1653558. So this could be talking all about same issue. I noticed the person posted some error console info, so I'll get the images into this report.

error console

Attached image 2020-07-20-08-07-09-d30d45.jpg (obsolete) —

Error console

Attached image 2020-07-20-08-06-39-0d2885.jpg (obsolete) —

missing header info

Attached image 2020-07-20-08-06-56-8fcd92.jpg (obsolete) —

Empty 'Address Book'

Attached image 2020-07-20-08-06-39-0d2885.jpg (obsolete) —
Attachment #9164760 - Attachment is obsolete: true
Attachment #9164761 - Attachment is obsolete: true
Attachment #9164763 - Attachment is obsolete: true
Attachment #9164764 - Attachment is obsolete: true
Attachment #9164766 - Attachment is obsolete: true

According to bug 1654005 this is also the cause of that bug.

Attached patch bug1653234_addrbook_broken.patch (obsolete) — Splinter Review

More descriptive messages on failures would have been helpful, so I added some more.

https://searchfox.org/comm-central/rev/8253c3f8bc4f81226f04a66678c13a782b697958/mail/base/modules/DisplayNameUtils.jsm#36 ->
https://searchfox.org/comm-central/rev/8253c3f8bc4f81226f04a66678c13a782b697958/mailnews/addrbook/jsaddrbook/AddrBookManager.jsm#173

When sorting the directories it breaks since there is no _prefBranch for the invalid directory.

I think the main problem here is in createDirectoryObject. If the uri was invalid we'd throw in init(), but we store the directory before we know that, so there's an invalid in the store and that breaks everything. Not sure the this._prefBranch check I added are needed after that is now fixed.

Assignee: nobody → mkmelin+mozilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(mkmelin+mozilla)
Attachment #9165013 - Flags: review?(khushil324)
Attachment #9165013 - Flags: review?(geoff)

Oh, not linted yet. I'll also send it to try.

Attachment #9165013 - Attachment is obsolete: true
Attachment #9165013 - Flags: review?(khushil324)
Attachment #9165013 - Flags: review?(geoff)
Attachment #9165015 - Flags: review?(khushil324)
Attachment #9165015 - Flags: review?(geoff)

(In reply to Magnus Melin [:mkmelin] from comment #20)

Oh, not linted yet. I'll also send it to try.

Please post a link to the try build, I'll have a couple users test it out. Thanks

Flags: needinfo?(mkmelin+mozilla)

Started a new try now: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=34c4e91415e4a658379128d2d0b1f76c2bd36278
(Once finished you can find a build in the artifacts of the job.)

Flags: needinfo?(mkmelin+mozilla)

I am seeing this error: JavaScript error: resource:///modules/AddrBookManager.jsm, line 204: InternalError: too much recursion
How can I test this patch? Code changes look good.

Not sure how that would happen, that's for the let uriParts = URI_REGEXP.exec(uri).
You could try to see what uri is causing it.

Anyway, the way to reproduce at least bug 1654005:
Put https://bug1654005.bmoattachments.org/attachment.cgi?id=9165287 into a user.js file in your Thunderbird profile. Then without the patch you'll see bug 1654005 when viewing a message.

With the patch I get this in the console:
JavaScript error: resource:///modules/AddrBookDirectory.jsm, line 139: NS_ERROR_UNEXPECTED: Unexpected uri: jsaddrbook://pab.na2.sqlite
JavaScript error: resource:///modules/AddrBookDirectory.jsm, line 139: NS_ERROR_UNEXPECTED: Unexpected uri: jsaddrbook://Privat.na2.sqlite
JavaScript error: resource:///modules/AddrBookDirectory.jsm, line 139: NS_ERROR_UNEXPECTED: Unexpected uri: jsaddrbook://Firma.na2.sqlite
JavaScript error: resource:///modules/AddrBookDirectory.jsm, line 139: NS_ERROR_UNEXPECTED: Unexpected uri: jsaddrbook://QuickList.na2.sqlite

... but the UI shows up alright. Since it's fake values I can't test things are migrated correctly still, but they should (the migration has a try/catch provision for it)

Comment on attachment 9165015 [details] [diff] [review]
bug1653234_addrbook_broken.patch

Review of attachment 9165015 [details] [diff] [review]:
-----------------------------------------------------------------

Code changes look good to me. r=khushil. I tested it with the steps mentioned by Magnus.
Attachment #9165015 - Flags: review?(khushil324)
Attachment #9165015 - Flags: review?(geoff)
Attachment #9165015 - Flags: review+
Attachment #9165015 - Flags: review+ → review?(geoff)

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/fb74ccc96256
handle bad address book prefs gracefully. r=khushil

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 80.0
Comment on attachment 9165015 [details] [diff] [review]
bug1653234_addrbook_broken.patch

[Approval Request Comment]
Regression caused by (bug #): the address book rework, unknown exact bug
User impact if declined: Bad prefs can cause broken UI and broken contact import
Testing completed (on c-c, etc.): soon
Attachment #9165015 - Flags: approval-comm-esr78?
Attachment #9165015 - Flags: approval-comm-beta?

Adding relevant search words to bug summary to make this more retrievable and prevent duplicates.
Bugzilla should really have a dedicated search words field for that.

Summary: update to beta 78 lost contacts → After updating to TB 78 beta, all contacts appear lost (entire address book empty/blank/not showing)
Comment on attachment 9165015 [details] [diff] [review]
bug1653234_addrbook_broken.patch

Approved for beta
Approved for esr78
Attachment #9165015 - Flags: approval-comm-esr78?
Attachment #9165015 - Flags: approval-comm-esr78+
Attachment #9165015 - Flags: approval-comm-beta?
Attachment #9165015 - Flags: approval-comm-beta+

(In reply to Kai Engert (:KaiE:) from comment #32)

https://hg.mozilla.org/releases/comm-beta/rev/797e2c49f29b29603b6577135827d13a349d391f 79.0b3
https://hg.mozilla.org/releases/comm-esr78/rev/96737f97b69731aa8b805ee07bb408fc504bc53f 78.1.0

Geoff, for users who installed 78.x prior to 78.1 and sees this failure, when updated to 78.1 their addressbooks will be converted and become visible?

If not, what process is recommended to restore functioning addressbooks?

A couple examples (there are several more):
https://support.mozilla.org/en-US/questions/1296745
https://support.mozilla.org/questions/1295952

Flags: needinfo?(geoff)

I think the user should have a functioning address book again. However, going by comment 26, they might need to rename one or more files and the pref(s) pointing to them. In that case the presence of an extra . is causing the problem and I suggest removing the .na2 part of the filename and pref value. (.na2 is the extension of a very old address book format, and appears .mab was just appended to the name rather than replacing it.)

Flags: needinfo?(geoff)

Actually, the above workaround should work with or without the patch from this bug.

Regressions: 1655685
See Also: → 1655686
Comment on attachment 9165015 [details] [diff] [review]
bug1653234_addrbook_broken.patch

When I saw this I recalled that the order of operations was on purpose, but I couldn't remember exactly why. I should've written a comment at the time but clearly I did not.

Clean-up in bug 1655685.
Attachment #9165015 - Flags: review?(geoff)
Duplicate of this bug: 1654005
You need to log in before you can comment on or make changes to this bug.