Closed
Bug 1162333
Opened 9 years ago
Closed 9 years ago
PromiseWorkerProxy should have stronger assertions in debug builds.
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: nsm, Assigned: nsm)
Details
Attachments
(2 files, 4 obsolete files)
1.22 KB,
patch
|
Details | Diff | Splinter Review | |
40 bytes,
text/x-review-board-request
|
catalinb
:
review+
|
Details |
Specifically, GetWorkerPrivate() should assert that mCleanedUpLock is owned by the caller when on the main thread. GetWorkerPromise() should assert it is not on the main thread.
Assignee | ||
Updated•9 years ago
|
Mentor: nsm.nikhil
Whiteboard: [good first bug][lang=C++]
Comment 1•9 years ago
|
||
hi i would like to work on this bug(i am a newbie in this field and have no experience.i know c/c++)
Comment 2•9 years ago
|
||
Hi, Shubham - That would be great! You can get started here: https://developer.mozilla.org/en-US/docs/Introduction and once you're set up and ready go go, let us know and Nikhil can tell you a bit about where to start. If you've got any questions about getting set up, email me. Thanks, and good luck!
Comment 3•9 years ago
|
||
(In reply to Mike Hoye [:mhoye] from comment #2) > Hi, Shubham - That would be great! You can get started here: > > https://developer.mozilla.org/en-US/docs/Introduction > > and once you're set up and ready go go, let us know and Nikhil can tell you > a bit about where to start. If you've got any questions about getting set > up, email me. > > Thanks, and good luck! hey i am ready to go.plz tell me how to get started
Assignee | ||
Comment 4•9 years ago
|
||
Hi Shubham, If you see mozilla::Mutex it has methods that check that a certain thread owns it. What you want to do is, in GetWorkerPrivate() #ifdef DEBUG if (NS_IsMainThread()) { // assert that mCleanUpLock is held by the current thread. } #endif And similarly for GetWorkerPromise()
Comment 5•9 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #4) > Hi Shubham, > > If you see mozilla::Mutex it has methods that check that a certain thread > owns it. > What you want to do is, in GetWorkerPrivate() > > #ifdef DEBUG > if (NS_IsMainThread()) { > // assert that mCleanUpLock is held by the current thread. > } > #endif > > And similarly for GetWorkerPromise() can you plz provide me with the paths of the files?
Assignee | ||
Comment 6•9 years ago
|
||
dom/promise/{Promise.cpp,PromiseWorkerProxy.h} If you need help from me, please use the "Need more information from" field below, otherwise i end up ignoring them.
Comment 8•9 years ago
|
||
Hi, Marco - it looks like Shubham is on top of this, can you email me at mhoye@mozilla.com so I can set you up with another one?
Comment 9•9 years ago
|
||
I just gave a try could someone please review my patch
Comment 10•9 years ago
|
||
Click the [details] link and set 'review' to '?' and put :nsm to the field which shows up.
Updated•9 years ago
|
Attachment #8612764 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8612764 [details] [diff] [review] pv1.diff Review of attachment 8612764 [details] [diff] [review]: ----------------------------------------------------------------- This looks good except for the indentation. ::: dom/promise/Promise.cpp @@ +1573,5 @@ > PromiseWorkerProxy::GetWorkerPrivate() const > { > // It's ok to race on |mCleanedUp|, because it will never cause us to fire > // the assertion when we should not. > + #ifdef DEBUG No need to indent preprocessor directives. They always go at the beginning of the line. @@ +1582,1 @@ > MOZ_ASSERT(!mCleanedUp); Move this back up to the relevant comment. @@ +1586,5 @@ > > Promise* > PromiseWorkerProxy::GetWorkerPromise() const > { > + #ifdef DEBUG Same here.
Attachment #8612764 -
Flags: review?(nsm.nikhil) → review+
Comment 12•9 years ago
|
||
I have fixed those things up.
Attachment #8612764 -
Attachment is obsolete: true
Updated•9 years ago
|
Attachment #8612972 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 13•9 years ago
|
||
Comment on attachment 8612972 [details] [diff] [review] pv2.diff Review of attachment 8612972 [details] [diff] [review]: ----------------------------------------------------------------- As a general rule, once an r+ has been granted, you don't have to ask again after fixing the comments, unless the reviewer has explicitly asked for it. If you have level 1 access, please push to try server, otherwise I'll do so.
Attachment #8612972 -
Flags: review?(nsm.nikhil) → review+
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → jinank94
Assignee | ||
Comment 14•9 years ago
|
||
Comment on attachment 8612972 [details] [diff] [review] pv2.diff Review of attachment 8612972 [details] [diff] [review]: ----------------------------------------------------------------- Ah after reading my own bug description again, this is actually wrong. I should've been clearer before about GetWorkerPromise(). ::: dom/promise/Promise.cpp @@ +1593,5 @@ > + if (NS_IsMainThread()) { > + mCleanUpLock.AssertCurrentThreadOwns(); > + } > +#endif > + This assertion should be changed to be #ifdef DEBUG WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); MOZ_ASSERT(worker); worker->AssertIsOnWorkerThread(); #endif since we want to assert that the worker promise is only accessed on the worker thread.
Attachment #8612972 -
Flags: review+ → review-
Comment 15•9 years ago
|
||
Attachment #8612972 -
Attachment is obsolete: true
Attachment #8613052 -
Flags: review+
Comment 16•9 years ago
|
||
Any Updates ?
Assignee | ||
Comment 17•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5833ba51a7cd
Assignee | ||
Comment 18•9 years ago
|
||
Jinank, please fix the test failures on try. All of them will likely involve acquiring and checking the cleanup mutex from the PromiseWorkerProxy before touching the WorkerPrivate. The current culprit is ClientFocusRunnable::DispatchResult(), but after you fix that, there may be others. This is the correct way to do it - https://dxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerClients.cpp#108
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(jinank94)
Comment 19•9 years ago
|
||
Attachment #8613052 -
Attachment is obsolete: true
Flags: needinfo?(jinank94) → needinfo?(nsm.nikhil)
Updated•9 years ago
|
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Comment 21•9 years ago
|
||
Comment on attachment 8620624 [details] [diff] [review] pv4.diff Review of attachment 8620624 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/promise/Promise.cpp @@ +1580,5 @@ > +#ifdef DEBUG > + if (NS_IsMainThread()) { > + mCleanUpLock.AssertCurrentThreadOwns(); > + } > +#endif Code that uses this should be modified as I mentioned in a previous comment to make sure it acquires this mutex. ClientFocusRunnable does not seem to do so. @@ +1591,5 @@ > { > + > +#ifdef DEBUG > + MutexAutoLock lock(mPromiseProxy->GetCleanUpLock()); > + if (mPromiseProxy->IsClean()) { I think you misunderstood me. This should not be acquiring the mutex, it should only be asserting is on worker thread.
Comment 22•9 years ago
|
||
Attachment #8620624 -
Attachment is obsolete: true
Updated•9 years ago
|
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Comment 23•9 years ago
|
||
The patch still hasn't been updated with the changes to ClientFocusRunnable https://dxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerWindowClient.cpp?from=ClientFocusRunnable&case=true#101 where it needs to acquire the lock. Also please set the review? flag on the attachment and not needinfo?
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Updated•9 years ago
|
Assignee: jinank94 → nsm.nikhil
Mentor: nsm.nikhil
Whiteboard: [good first bug][lang=C++]
Assignee | ||
Comment 24•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7a55356e0e7e
Assignee | ||
Comment 25•9 years ago
|
||
Bug 1162333 - Add stronger assertions to PromiseWorkerProxy in debug builds. r?catalinb
Attachment #8643944 -
Flags: review?(catalin.badea392)
Comment 26•9 years ago
|
||
Comment on attachment 8643944 [details] MozReview Request: Bug 1162333 - Add stronger assertions to PromiseWorkerProxy in debug builds. r?catalinb https://reviewboard.mozilla.org/r/15185/#review14569 Ship It!
Attachment #8643944 -
Flags: review?(catalin.badea392) → review+
Assignee | ||
Comment 27•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=85d8854a7f3e
Assignee | ||
Comment 28•9 years ago
|
||
url: https://hg.mozilla.org/integration/mozilla-inbound/rev/5fc9ba7d1273e1e9e6320b502f9753c8515fe2b4 changeset: 5fc9ba7d1273e1e9e6320b502f9753c8515fe2b4 user: Jinank Jain <jinank94@gmail.com> date: Thu Jun 11 00:35:18 2015 +0200 description: Bug 1162333 - Add stronger assertions to PromiseWorkerProxy in debug builds. r=catalinb
Assignee | ||
Comment 29•9 years ago
|
||
url: https://hg.mozilla.org/integration/mozilla-inbound/rev/7bc0c166a74454ae2e589a9a5c886666ea935bd2 changeset: 7bc0c166a74454ae2e589a9a5c886666ea935bd2 user: Nikhil Marathe <nsm.nikhil@gmail.com> date: Tue Aug 18 10:00:35 2015 -0700 description: Bug 1162333 - Fix windows bustage. a=bustage CLOSED TREE
https://hg.mozilla.org/mozilla-central/rev/5fc9ba7d1273 https://hg.mozilla.org/mozilla-central/rev/7bc0c166a744
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•