Closed
Bug 1360372
Opened 7 years ago
Closed 7 years ago
Acquire a cooperative thread lock when entering the system zone
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: billm, Assigned: billm)
References
Details
Attachments
(2 files, 1 obsolete file)
8.41 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
6.42 KB,
patch
|
sfink
:
review+
|
Details | Diff | Splinter Review |
This patch adds a callback where we can ask Gecko to yield to other cooperative threads. We call the yield callback when entering the system zone group when another context already owns the system zone group.
Attachment #8862643 -
Flags: review?(bhackett1024)
Assignee | ||
Comment 1•7 years ago
|
||
Comment on attachment 8862643 [details] [diff] [review] patch Brian gave an r+ by email since his internet connectivity is limited.
Attachment #8862643 -
Flags: review?(bhackett1024) → review+
Pushed by wmccloskey@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/fd049b7bf3d2 Acquire cooperative lock when entering system zone group (r=bhackett)
Comment 3•7 years ago
|
||
Backed out for hazards: https://hg.mozilla.org/integration/mozilla-inbound/rev/cc77c0f84a03b136ade5768ad111e4b79f454ebe Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=fd049b7bf3d233fa51227992f1cbd8bfcdad1e98&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=runnable
Flags: needinfo?(wmccloskey)
Assignee | ||
Comment 4•7 years ago
|
||
This patch avoids a rooting hazard involving the atoms compartment. There is code in jsatom.cpp that enters the atoms compartment while unrooted pointers are on the stack. Now that enterZoneGroup can potentially yield, this leads to a rooting hazard. This patch avoids the hazard by using a totally separate path that avoids enterZoneGroup when entering the atoms compartment.
Flags: needinfo?(wmccloskey)
Attachment #8863301 -
Flags: review?(sphink)
Comment 5•7 years ago
|
||
Comment on attachment 8863301 [details] [diff] [review] fix rooting hazard Review of attachment 8863301 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jscntxt.h @@ +206,5 @@ > + // Special enterCompartment for atoms compartment. It requires > + // locking. Also, we avoid calling enterZoneGroup since that can induce GC > + // hazards. > + inline void enterAtomsCompartment(JSCompartment* c, > + const js::AutoLockForExclusiveAccess* maybeLock); Can't this be AutoLockForExclusiveAccess& ? ::: js/src/jscntxtinlines.h @@ +455,4 @@ > { > enterCompartmentDepth_++; > > if (!c->zone()->isAtomsZone()) Can this MOZ_ASSERT(!c->zone()->isAtomsZone()), or is there another way of getting here with an atoms compartment? It seems like you don't want to allow that, since the caller might not have the lock in that case. @@ +464,5 @@ > + > +inline void > +JSContext::enterAtomsCompartment( > + JSCompartment* c, > + const js::AutoLockForExclusiveAccess* maybeLock) You're in JS-land, I think that'll all fit in 99 chars. ::: js/src/jscompartment.h @@ +1059,2 @@ > inline AutoCompartment(JSContext* cx, JSCompartment* target, > + AutoLockForExclusiveAccess* maybeLock); If this is only used for the atoms compartment now, can you make this AutoLockForExclusiveAccess& lock? ::: js/src/jscompartmentinlines.h @@ +43,5 @@ > { > cx_->enterCompartmentOf(target); > } > > // Protected constructor that bypasses assertions in enterCompartmentOf. Also mention here that it's only for the atoms compartment. (If there were no comment here at all, it'd be fine to just not say anything since the header has it, but given that there is, it seems weird to omit that detail.)
Attachment #8863301 -
Flags: review?(sphink)
Assignee | ||
Comment 6•7 years ago
|
||
Looks like that was the only way we entered the atoms compartment (to the extent that I can start a browser with the assertion in place).
Attachment #8863301 -
Attachment is obsolete: true
Attachment #8863457 -
Flags: review?(sphink)
Updated•7 years ago
|
Attachment #8863457 -
Flags: review?(sphink) → review+
Pushed by wmccloskey@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/11a43a7edbae Acquire cooperative lock when entering system zone group (r=bhackett) https://hg.mozilla.org/integration/mozilla-inbound/rev/7292d50807c9 Avoid rooting hazard when entering atoms compartment (r=sfink)
Comment 8•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/11a43a7edbae https://hg.mozilla.org/mozilla-central/rev/7292d50807c9
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•