Closed Bug 1931863 Opened 3 months ago Closed 24 days ago

[tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length

Categories

(Thunderbird :: General, defect)

defect

Tracking

(thunderbird_esr128 affected, thunderbird135 fixed)

RESOLVED FIXED
136 Branch
Tracking Status
thunderbird_esr128 --- affected
thunderbird135 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: mkmelin)

References

Details

(Keywords: intermittent-failure, intermittent-testcase)

Attachments

(3 files, 1 obsolete file)

Group: mail-core-security
Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Attachment #9438641 - Attachment is obsolete: true
See Also: → 1940154
Attachment #9444263 - Attachment description: Bug 1931863 - V2: Fix [tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length. r=BenC,#thunderbird-reviewers → Bug 1931863 - V2: Fix [tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length. r=BenC
Target Milestone: --- → 136 Branch

Wow. This is an incedibly useful report.

I think we should investigate this concurrency more deeply.

I'd prefer to implement more complete protection of member variables before committing.

OK, I've managed to catch a concrete case of the asyncpump causing reentrancy to MboxParser->Feed(), so this isn't a speculative issue any more.
(I just added a bool member var to MboxParser which I set while inside Feed(), and asserted if it was already set at the start).

I think Kai's patch is the way to go (and should probably be uplifted, once landed).

I think Bug 1917447 might be down to this, but I'm still following up.
That bug deals with NNTP and messages with large, mime-encoded attachments. My theory is that line lengths on such NNTP messages tends to be longer than for email messages, and that difference causes enough change in timing for the STS and main thread to step on each other's toes.
Bug 1917447 tends to cause a hard crash, which is kind of comforting - less chance for unnoticed weirdness.
Anyway, I'll test this patch against that bug and report back.

Reporting back: Kai's patch seemed to fix the crashing in Bug 1917447 - hooray!
(I'll add my STR over there, but I suspect you could replicate it on a local folder (rather than NNTP) with some fake emails with big attachments and long line lengths)

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/564a0a9d4682
V2: Fix [tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length. r=BenC
https://hg.mozilla.org/comm-central/rev/e64e5d561ed8
Additional locking for MboxMsgInputStream. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 25 days ago
Resolution: --- → FIXED
Duplicate of this bug: 1940154
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Prevent namespace pollution as per
https://firefox-source-docs.mozilla.org/code-quality/coding-style/coding_style_cpp.html#c-namespaces

Also minor tweak to remove locking in the constructor (no other thread can access the object during construction).

See Also: → 1940588

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/8513f49ad8b0
Remove mozilla namespace pollution from MboxMsgInputStream header. r=kaie,mkmelin

Status: REOPENED → RESOLVED
Closed: 25 days ago24 days ago
Resolution: --- → FIXED

Comment on attachment 9444263 [details]
Bug 1931863 - V2: Fix [tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length. r=BenC

[Approval Request Comment] (all the 3 patches)
User impact if declined: unexpected behavior, and potential crash
Testing completed (on c-c, etc.): c-c
Risk to taking this patch (and alternatives if risky): not risk free, so good to bake on beta before potential uplift

Attachment #9444263 - Flags: approval-comm-beta?

Comment on attachment 9444263 [details]
Bug 1931863 - V2: Fix [tsan] perma comm/mailnews/base/test/unit/test_folderCompact2.js | ThreadSanitizer: data race /builds/worker/workspace/obj-build/dist/include/nsTArray.h:397:37 in Length. r=BenC

[Triage Comment]
Approved for beta
Let's keep an eye on these in beta as release of 135.0 in 3 weeks is slated to be the default download on tb.net.

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

Comment on attachment 9446026 [details]
Bug 1931863 - Additional locking for MboxMsgInputStream. r=mkmelin

[Triage Comment]
Approved for beta

Attachment #9446026 - Flags: approval-comm-beta+

Comment on attachment 9446403 [details]
Bug 1931863 - Remove mozilla namespace pollution from MboxMsgInputStream header. r=#thunderbird-back-end-reviewers

[Triage Comment]
Approved for beta

Attachment #9446403 - Flags: approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: