Closed Bug 549743 Opened 14 years ago Closed 14 years ago

Abort if cycle collected object is refcounted from non-main-thread

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sicking, Assigned: sicking)

References

Details

(Whiteboard: [crashkill])

Attachments

(1 file)

Attached patch Patch to fixSplinter Review
To avoid race conditions that cause leaks and crashes sometimes, we should make sure that people that use cycle collected objects from threads other than the main thread know about it.

The easiest way to do that is to abort as soon as someone does it.

This needs to happen early in a release cycle so that developers have time to notice and fix their code.

Now is a good such time.
Attachment #429849 - Flags: review?(dbaron)
Attachment #429849 - Attachment is patch: true
Attachment #429849 - Attachment mime type: application/octet-stream → text/plain
Oh, and I don't care strongly about the name here. Feel free to come up with better suggestions.
Assignee: nobody → jonas
Status: NEW → ASSIGNED
Comment on attachment 429849 [details] [diff] [review]
Patch to fix

How about "AbortIfOffMainThreadAndHaveFastMainThreadCheck"?  It's a little more verbose, but it says what it does.

r=dbaron
Attachment #429849 - Flags: review?(dbaron) → review+
Dbaron suggested "IfCheckFastAbortIfOffMainThread" on irc. I'll go with that.
Depends on: 521750
As someone who's add-on is now frequently triggering this abort at startup in the trunk loads, I'm confused as to why that's happening.  It appears to be triggered by a call to nsWindowMediator::GetMostRecentWindow which my add-on isn't making.

See http://forums.mozillazine.org/viewtopic.php?f=19&t=1790145 for details.

Am I to take it that threads can't be safely used until the initial "domwindowopened" notification fires?
Please file a new bug and attach a stack. And cc me.
(In reply to comment #5)
> Please file a new bug and attach a stack. And cc me.

A stack or a link to a crash report.
Never mind I tracked my problem down to a call elsewhere in my code.  While looking at bug reports though I did see a few that occurred with no extensions installed though.
Were there literally no extensions listed? You should look at the uptime field, it's possible that it was a startup crash before we collected the extension data.
Up-time was 1 second so most likely that's what happened.
Sicking landed this a few weeks ago:
http://hg.mozilla.org/mozilla-central/rev/0d5553264cbf.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: