Closed Bug 1735508 Opened 3 years ago Closed 3 years ago

Crashes during autocomplete when entering group alias from mac's or Windows contacts. @ mozilla::SegmentedVector<T>::PopLastN @ nsArrayBase::QueryElementAt

Categories

(Thunderbird :: Message Compose Window, defect, P1)

Thunderbird 91
Unspecified
All

Tracking

(thunderbird_esr91+ fixed, thunderbird94+ fixed)

RESOLVED FIXED
95 Branch
Tracking Status
thunderbird_esr91 + fixed
thunderbird94 + fixed

People

(Reporter: bgrinstein, Assigned: KaiE)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: crash, regression, reproducible)

Crash Data

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

Steps to reproduce:

Entered the name of a "Group" that was defined in Mac OS X Contacts. After typing a few letters into the "To" field a short list of possible completions showed up and I selected the desired one, a Groups defined in contacts. Then hit entered and Thunderbird immediately crashed and the crash report window opened up. This is 100% reproducible

Actual results:

Crashed

Expected results:

?? I should have been able to enter text in Subject and in the body of the email

Perhaps related to bug 1718862 comment 3.

What is your crash ID from Help > More troubleshooting information?

Flags: needinfo?(bgrinstein)
Keywords: crash

(In reply to Wayne Mery (:wsmwk) from comment #1)

Perhaps related to bug 1718862 comment 3.

What is your crash ID from Help > More troubleshooting information?
Any of these (I think they were all caused by the same, as I was first stubborn and then just wanted to insure it was reproducible)

ID: bp-a7b4976a-55f1-409e-ba71-5524c0211013 91.2.0
ID: bp-cbc4eb48-a1e6-4d01-8d51-bc9330211013 91.2.0
ID: bp-41e1098c-fd7d-49fb-aa97-4bc5b0211013 91.2.0
ID: bp-cca5cea6-010a-48c5-8bcb-93bc60211013 91.2.0
ID: bp-a7b4976a-55f1-409e-ba71-5524c0211013 91.2.0

Flags: needinfo?(bgrinstein)

All four crashes (the last one is a duplicate of the first) are @ mozilla::SegmentedVector<T>::PopLastN.

The last three all have uptime of only 20 seconds. Are you really getting into compose and providing an alias in the compose field for those crashes?

bp-a7b4976a-55f1-409e-ba71-5524c0211013
0 XUL mozilla::SegmentedVector<nsCOMPtr<nsISupports>, (unsigned long)4096, mozilla::MallocAllocPolicy>::PopLastN(unsigned int) mfbt/SegmentedVector.h:262
1 XUL mozilla::dom::DeferredFinalizerImpl<nsISupports>::DeferredFinalize(unsigned int, void*) dom/bindings/BindingUtils.h:2753
2 XUL mozilla::IncrementalFinalizeRunnable::ReleaseNow(bool) xpcom/base/CycleCollectedJSRuntime.cpp:1648
3 XUL mozilla::IncrementalFinalizeRunnable::Run() xpcom/base/CycleCollectedJSRuntime.cpp:1685
4 XUL IdleRunnableWrapper::Run() xpcom/threads/nsThreadUtils.cpp:310
5 XUL mozilla::RunnableTask::Run() xpcom/threads/TaskController.cpp:502
6 XUL mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) xpcom/threads/TaskController.cpp:805

Status: UNCONFIRMED → NEW
Crash Signature: [@ mozilla::SegmentedVector<T>::PopLastN ]
Ever confirmed: true
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(bgrinstein)
See Also: → 1718862

(In reply to Wayne Mery (:wsmwk) from comment #3)

All four crashes (the last one is a duplicate of the first) are @ mozilla::SegmentedVector<T>::PopLastN.

The last three all have uptime of only 20 seconds. Are you really getting into compose and providing an alias in the compose field for those crashes?

bp-a7b4976a-55f1-409e-ba71-5524c0211013
0 XUL mozilla::SegmentedVector<nsCOMPtr<nsISupports>, (unsigned long)4096, mozilla::MallocAllocPolicy>::PopLastN(unsigned int) mfbt/SegmentedVector.h:262
1 XUL mozilla::dom::DeferredFinalizerImpl<nsISupports>::DeferredFinalize(unsigned int, void*) dom/bindings/BindingUtils.h:2753
2 XUL mozilla::IncrementalFinalizeRunnable::ReleaseNow(bool) xpcom/base/CycleCollectedJSRuntime.cpp:1648
3 XUL mozilla::IncrementalFinalizeRunnable::Run() xpcom/base/CycleCollectedJSRuntime.cpp:1685
4 XUL IdleRunnableWrapper::Run() xpcom/threads/nsThreadUtils.cpp:310
5 XUL mozilla::RunnableTask::Run() xpcom/threads/TaskController.cpp:502
6 XUL mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) xpcom/threads/TaskController.cpp:805

Yes. I had the crash report dialogue restart Thunderbird and I immediately hit compose, entered the address (the group name) and it crashed. Then I repeated this a few times, as stated. BTW I just tried it with a new group, just to check that it was not somethiung specifically wrong about that Group. It crashed again

Flags: needinfo?(bgrinstein)

I don't have any further input, and no mac to reproduce either.

Flags: needinfo?(mkmelin+mozilla)

Maybe I should add, this is a macbook pro with the M1 chip running Big Sur (OS X 11.6)

This is easily reproduced. I'm on Macbook pro 2016 running 11.6, Thunderbird 94.0b2. But I get a variety of crash signatures:

Did this work for you when using version 78?

Flags: needinfo?(bgrinstein)
Summary: Crashes when entering group alias from mac's Contacts → Crashes during autocomplete when entering group alias from mac's Contacts
See Also: → 1045992

Although this signature is in cycle collector or gc, if we have the reproduce step, I guess that something thunderbird's XPCOM object will be released/destroyed in non-main thread.

(In reply to Wayne Mery (:wsmwk) from comment #7)

This is easily reproduced. I'm on Macbook pro 2016 running 11.6, Thunderbird 94.0b2. But I get a variety of crash signatures:

Did this work for you when using version 78?
Crashes only started when I updated to v 91, it worked without a problem previous to that update

While the bug was changed to crashes when "autocomplete", I just checked that it still crashes even when I input the complete group name by hand

Flags: needinfo?(bgrinstein)

I installed 93.0b5 - address lookup for Mac contacts doesn't happen at all. So it's not possible to say whether 93 would crash.

Keywords: reproducible
Priority: -- → P1

Kai, please have a look

Assignee: nobody → kaie

I can reproduce using a local esr91 build. I have the full stack. It's crashing while trying to delete elements. The crash suggests that some of the assertions isn't true, but the assertion checks are no-ops in the optimized build.

I will do a local debug build, hopefully this will allow me to find the first time an assertion check fails.

Attached file stack.txt
Attached file real-stack.txt

This is the stack of the first crash when running a debug build.

I'm guessing we have a pointer to an object from the OS (probably a pointer to an OS address book object), and it's being incorrectly deleted.

Does the stack help you to understand what might be wrong?

Flags: needinfo?(m_kato)

Magnus, I suggest to re-review the past year's patches that touched the implementation for mac OS address books. Maybe that code incorrectly copies a system handle to two different places, causing it to deleted twice.

Flags: needinfo?(mkmelin+mozilla)

There's many such patches though... I guess https://hg.mozilla.org/comm-central/log/tip/mailnews/addrbook/src/nsAbOSXDirectory.mm and related files.

Flags: needinfo?(mkmelin+mozilla)

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

Does the stack help you to understand what might be wrong?

I guess https://searchfox.org/comm-central/rev/0e154d21c2179c0f4cad51fa61bbab20f494dbc2/mailnews/addrbook/src/nsAbDirProperty.cpp#371.

We should use listDir.forget(aResult) instead.

Flags: needinfo?(m_kato)

(In reply to Makoto Kato [:m_kato] from comment #20)

I guess https://searchfox.org/comm-central/rev/0e154d21c2179c0f4cad51fa61bbab20f494dbc2/mailnews/addrbook/src/nsAbDirProperty.cpp#371.
We should use listDir.forget(aResult) instead.

Thank you very much! With that change, I can no longer reproduce the crash!

Regressed by: 1712601
Crash Signature: [@ mozilla::SegmentedVector<T>::PopLastN ] → [@ mozilla::SegmentedVector<T>::PopLastN ] [@ nsArrayBase::QueryElementAt ]

Sharp eyes! Many thanks m_kato!

Status: NEW → ASSIGNED
Target Milestone: --- → 95 Branch
Attachment #9247774 - Attachment description: Bug 1735508 - Fix pointer ownership. Fix by Makoto Kato. r=mkmelin → Bug 1735508 - Fix pointer ownership to prevent crash when entering group alias in mac address book. r=mkmelin

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/aa53cab20da1
Fix pointer ownership to prevent crash when entering group alias in mac address book. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

Comment on attachment 9247774 [details]
Bug 1735508 - Fix pointer ownership to prevent crash when entering group alias in mac address book. r=mkmelin

[Approval Request Comment]
Regression caused by (bug #): 1712601
User impact if declined: crash
Testing completed (on c-c, etc.): manual
Risk to taking this patch (and alternatives if risky): very low, obvious fix to avoid duplicate pointer delete

Attachment #9247774 - Flags: approval-comm-esr91?
Attachment #9247774 - Flags: approval-comm-beta?

Comment on attachment 9247774 [details]
Bug 1735508 - Fix pointer ownership to prevent crash when entering group alias in mac address book. r=mkmelin

[Triage Comment]
Crash fix for 94 beta.

Attachment #9247774 - Flags: approval-comm-beta? → approval-comm-beta+

Comment on attachment 9247774 [details]
Bug 1735508 - Fix pointer ownership to prevent crash when entering group alias in mac address book. r=mkmelin

[Triage Comment]
approved for esr91

It hasn't yet shipped in beta, but the patch is simple, and only impacts Mac AB - i.e. it can't get get much worse for Mac.

Flags: needinfo?(de.berberich)
Flags: needinfo?(acdp)
Attachment #9247774 - Flags: approval-comm-esr91? → approval-comm-esr91+

We probably want to file another bug report for @ mozilla::SegmentedVector<T>::PopLastN which has reporters using Windows

(In reply to Wayne Mery (:wsmwk) from comment #29)

We probably want to file another bug report for @ mozilla::SegmentedVector<T>::PopLastN which has reporters using Windows

If user uses Outlook's address book integration, I guess that same issue may occur on Windows too.

I tried to reproduce this issue in TB 91 on my iMac running macOS 10.14.6.
TB didn't crash when I entered the first letters of a list name in my Mac "Contacts" and let autocomplete do its work. TB did not crash when I hit the Tab key to navigate to the text field of the compose window. So I saved the message as a draft in the Drafts folder.
When I edit the saved draft message TB crashes.
Crash IDs
7d278f2f-2e77-40da-a049-e2f5e0211028
1b5f2575-32fe-454c-bbe1-495b30211028

Flags: needinfo?(de.berberich)

bp-7d278f2f-2e77-40da-a049-e2f5e0211028 -> @ nsArrayBase::QueryElementAt 91.2.1 Mac
bp-1b5f2575-32fe-454c-bbe1-495b30211028 ->@ ChildFinder::NoteXPCOMChild 91.2.1 Mac

We will have to check the results at backtrace to see if the crash rate reduces

Summary: Crashes during autocomplete when entering group alias from mac's Contacts → Crashes during autocomplete when entering group alias from mac's or Windows contacts. @ mozilla::SegmentedVector<T>::PopLastN @ nsArrayBase::QueryElementAt
Severity: -- → S2
OS: Unspecified → All

Ha, as much as I run a mac, (though not mad on MS stuff either), I do not have contacts in the Mac AB, never use Safri, mail, or any MAc app, much. Bout only app is Finder
I will need to set up contcts and test if still a concern

Flags: needinfo?(acdp)

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

bp-7d278f2f-2e77-40da-a049-e2f5e0211028 -> @ nsArrayBase::QueryElementAt
bp-1b5f2575-32fe-454c-bbe1-495b30211028 ->@ ChildFinder::NoteXPCOMChild

Build id is old (20211020014537), try newer build when newer is released.

See Also: 1045992
See Also: → 1718911
Blocks: 1749210
Blocks: 1773690

Benjamin,
Is the crash gone for you?

Flags: needinfo?(bgrinstein)

Hi Wayne.
Yes, no more crashes, the bug seems to have been fixed.
Thx

Flags: needinfo?(bgrinstein)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: