Closed Bug 1735244 Opened 3 years ago Closed 3 years ago

Assertion failure: mDataMutex.TryLock() (Mutex shouldn't be locked in any thread, as it's about to be destroyed in ~ThreadRegistration()), at tools/profiler/core/ProfilerThreadRegistration.cpp:55

Categories

(Core :: Gecko Profiler, defect, P1)

defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- unaffected
firefox93 --- wontfix
firefox94 --- wontfix
firefox95 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Found by Florian in https://treeherder.mozilla.org/logviewer?job_id=354394127&repo=try&lineNumber=2735

This assertion is in fact incorrect at that point: The ThreadRegistration is still registered in the public ThreadRegistry, so another thread could find it and lock its mutex.
The assertion should be moved after ThreadRegistry::Unregister(OnThreadRef{*this});.

The data-mutex lock assertion in the ThreadRegistration destructor was done too early, because that ThreadRegistration could still be publicly accessible through the ThreadRegistry at that time.
This assertion is now moved after ThreadRegistry::UnregisterThread, after which other threads shouldn't have access to this ThreadRegistration anymore.

This patch also adds a stress gtest that registers and unregisters a thread many times, and a separate thread attempts to access and lock the test thread data. It did trigger the previous assertion before it was moved.

Assignee: nobody → gsquelart
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1721939

Is there a real-world impact here which would justify backport consideration or can this fix ride the trains to release?

Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9b9f8bfe2625 Moved inter-thread access assertion after the thread is actually unregistered - r=canaltinova
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch

(In reply to Ryan VanderMeulen [:RyanVM] from comment #3)

Is there a real-world impact here which would justify backport consideration or can this fix ride the trains to release?

Thank you Ryan for asking.
The problem was a badly-placed MOZ_ASSERT, so it would only affect DEBUG builds, and only when running the profiler.
I think the population of Profiler users on DEBUG non-Nightly is tiny (zero?). And we haven't seen this assertion trigger in our CI or crash reports either. So I don't think it's worth backporting.

Flags: needinfo?(gsquelart)
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: