|
|
Created:
4 years ago by sof Modified:
4 years ago CC:
chromium-reviews, kenneth.christiansen, Yoav Weiss, Mikhail, wanming.lin, shalamov, mlamouri+watch-blink_chromium.org, blink-reviews-css, timvolodine, dglazkov+blink, apavlov+blink_chromium.org, cmumford, darktears, blink-reviews, jsbell+idb_chromium.org, rwlbuis Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionSignal no pending activity in destructed contexts.
Various hasPendingActivity() overrides weren't taking the state of the
ExecutionContext into account, only considering if event listeners were
registered. We're not interested in holding onto a script environment
after an execution context has been destroyed, so adjust the predicates
to return false if the ExecutionContext has been destructed.
The V8GCController wrapper visitors already check if hasPendingActivity()
implementations incorrectly return |true| when used inside of destroyed
ExecutionContexts, but that check is not handled by trace wrappers
(ActiveScriptWrappable.)
R=
BUG=
Committed: https://crrev.com/cf43a3b249e837503fad6d815d74346d7a187f84
Cr-Commit-Position: refs/heads/master@{#438787}
Patch Set 1 #
Messages
Total messages: 28 (13 generated)
The CQ bit was checked by sigbjornf@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
sigbjornf@opera.com changed reviewers: + dcheng@chromium.org, haraken@chromium.org
please take a look.
Description was changed from ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't take the state of the ExecutionContext into account, only considering if event listeners are registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the tests. R= BUG=658240 ========== to ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. R= BUG=658240 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
haraken@chromium.org changed reviewers: + mlippautz@chromium.org
LGTM Before enabling the wrapper tracing, we don't need the getExecutionContext() check, because we forcibly return false from hasPendingActivity on a detached context: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/... However, we don't yet have the logic in the wrapper tracing. So your change is needed after enabling the wrapper tracing. An ideal fix would be to add ActiveScriptWrappable::m_executionContext and make ActiveScriptWrappable::hasPendingActivity return false after the context is detached.
Description was changed from ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. R= BUG=658240 ========== to ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG=658240 ==========
On 2016/12/14 15:56:20, haraken wrote: > LGTM > > Before enabling the wrapper tracing, we don't need the getExecutionContext() > check, because we forcibly return false from hasPendingActivity on a detached > context: > > https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/... > > However, we don't yet have the logic in the wrapper tracing. So your change is > needed after enabling the wrapper tracing. > > An ideal fix would be to add ActiveScriptWrappable::m_executionContext and make > ActiveScriptWrappable::hasPendingActivity return false after the context is > detached. Yes, it'd be better if this detail could be kept out of hasPendingActivity() implementations and instead be provided "for free". Extending all ActiveScriptWrappables with an extra field is not "free" for those implementations which doesn't override hasPendingActivity(), unfortunately. I've updated the description to make it more accurate.
On 2016/12/14 16:26:33, sof wrote: > On 2016/12/14 15:56:20, haraken wrote: > > LGTM > > > > Before enabling the wrapper tracing, we don't need the getExecutionContext() > > check, because we forcibly return false from hasPendingActivity on a detached > > context: > > > > > https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/... > > > > However, we don't yet have the logic in the wrapper tracing. So your change is > > needed after enabling the wrapper tracing. > > > > An ideal fix would be to add ActiveScriptWrappable::m_executionContext and > make > > ActiveScriptWrappable::hasPendingActivity return false after the context is > > detached. > > Yes, it'd be better if this detail could be kept out of hasPendingActivity() > implementations and instead be provided "for free". Extending all > ActiveScriptWrappables with an extra field is not "free" for those > implementations which doesn't override hasPendingActivity(), unfortunately. > > I've updated the description to make it more accurate. This seems a bit fragile. There's a number of places that override this, and they all check this slightly differently. It's also hard to tell if they're correct just by inspection. For example, DOMFileSystem::hasPendingActivity() just check that there are a positive number of callbacks. It's hard for me to tell if that check is correct or not, given this patch.
On 2016/12/14 17:03:11, dcheng wrote: > On 2016/12/14 16:26:33, sof wrote: > > On 2016/12/14 15:56:20, haraken wrote: > > > LGTM > > > > > > Before enabling the wrapper tracing, we don't need the getExecutionContext() > > > check, because we forcibly return false from hasPendingActivity on a > detached > > > context: > > > > > > > > > https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/... > > > > > > However, we don't yet have the logic in the wrapper tracing. So your change > is > > > needed after enabling the wrapper tracing. > > > > > > An ideal fix would be to add ActiveScriptWrappable::m_executionContext and > > make > > > ActiveScriptWrappable::hasPendingActivity return false after the context is > > > detached. > > > > Yes, it'd be better if this detail could be kept out of hasPendingActivity() > > implementations and instead be provided "for free". Extending all > > ActiveScriptWrappables with an extra field is not "free" for those > > implementations which doesn't override hasPendingActivity(), unfortunately. > > > > I've updated the description to make it more accurate. > > This seems a bit fragile. There's a number of places that override this, and > they all check this slightly differently. It's also hard to tell if they're > correct just by inspection. For example, DOMFileSystem::hasPendingActivity() > just check that there are a positive number of callbacks. It's hard for me to > tell if that check is correct or not, given this patch. I don't understand what you expect to see. Each object has a different notion of must-stay-alive, that's why they override the default of returning |false|. What commonality do you expect to see?
On 2016/12/14 18:16:40, sof wrote: > On 2016/12/14 17:03:11, dcheng wrote: > > On 2016/12/14 16:26:33, sof wrote: > > > On 2016/12/14 15:56:20, haraken wrote: > > > > LGTM > > > > > > > > Before enabling the wrapper tracing, we don't need the > getExecutionContext() > > > > check, because we forcibly return false from hasPendingActivity on a > > detached > > > > context: > > > > > > > > > > > > > > https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/... > > > > > > > > However, we don't yet have the logic in the wrapper tracing. So your > change > > is > > > > needed after enabling the wrapper tracing. > > > > > > > > An ideal fix would be to add ActiveScriptWrappable::m_executionContext and > > > make > > > > ActiveScriptWrappable::hasPendingActivity return false after the context > is > > > > detached. > > > > > > Yes, it'd be better if this detail could be kept out of hasPendingActivity() > > > implementations and instead be provided "for free". Extending all > > > ActiveScriptWrappables with an extra field is not "free" for those > > > implementations which doesn't override hasPendingActivity(), unfortunately. > > > > > > I've updated the description to make it more accurate. > > > > This seems a bit fragile. There's a number of places that override this, and > > they all check this slightly differently. It's also hard to tell if they're > > correct just by inspection. For example, DOMFileSystem::hasPendingActivity() > > just check that there are a positive number of callbacks. It's hard for me to > > tell if that check is correct or not, given this patch. > > I don't understand what you expect to see. Each object has a different notion of > must-stay-alive, that's why they override the default of returning |false|. What > commonality do you expect to see? Right, but when is it OK for hasPendingActivity() to not check that the context is still live? Is there some guideline here?
On 2016/12/14 18:29:35, dcheng wrote: > On 2016/12/14 18:16:40, sof wrote: > > On 2016/12/14 17:03:11, dcheng wrote: > > > On 2016/12/14 16:26:33, sof wrote: > > > > On 2016/12/14 15:56:20, haraken wrote: ... > > > > > > > > Yes, it'd be better if this detail could be kept out of > hasPendingActivity() > > > > implementations and instead be provided "for free". Extending all > > > > ActiveScriptWrappables with an extra field is not "free" for those > > > > implementations which doesn't override hasPendingActivity(), > unfortunately. > > > > > > > > I've updated the description to make it more accurate. > > > > > > This seems a bit fragile. There's a number of places that override this, and > > > they all check this slightly differently. It's also hard to tell if they're > > > correct just by inspection. For example, DOMFileSystem::hasPendingActivity() > > > just check that there are a positive number of callbacks. It's hard for me > to > > > tell if that check is correct or not, given this patch. > > > > I don't understand what you expect to see. Each object has a different notion > of > > must-stay-alive, that's why they override the default of returning |false|. > What > > commonality do you expect to see? > > Right, but when is it OK for hasPendingActivity() to not check that the context > is still live? Is there some guideline here? Only that the predicate must transition to |false| eventually to prevent leaks/retention. I'm not aware of cases where that's not what's wanted, but haraken@ may have come across some. Some implementations have weaker forms of life-end than EOL for the ExecutionContext, but could the implementations be more regular? Definitely; looking closer, I think extending ActiveScriptWrappables with an ExecutionContext member to handle the detached ExecutionContext case, is the way to go.
On 2016/12/14 19:26:35, sof wrote: > On 2016/12/14 18:29:35, dcheng wrote: > > On 2016/12/14 18:16:40, sof wrote: > > > On 2016/12/14 17:03:11, dcheng wrote: > > > > On 2016/12/14 16:26:33, sof wrote: > > > > > On 2016/12/14 15:56:20, haraken wrote: > ... > > > > > > > > > > Yes, it'd be better if this detail could be kept out of > > hasPendingActivity() > > > > > implementations and instead be provided "for free". Extending all > > > > > ActiveScriptWrappables with an extra field is not "free" for those > > > > > implementations which doesn't override hasPendingActivity(), > > unfortunately. > > > > > > > > > > I've updated the description to make it more accurate. > > > > > > > > This seems a bit fragile. There's a number of places that override this, > and > > > > they all check this slightly differently. It's also hard to tell if > they're > > > > correct just by inspection. For example, > DOMFileSystem::hasPendingActivity() > > > > just check that there are a positive number of callbacks. It's hard for me > > to > > > > tell if that check is correct or not, given this patch. > > > > > > I don't understand what you expect to see. Each object has a different > notion > > of > > > must-stay-alive, that's why they override the default of returning |false|. > > What > > > commonality do you expect to see? > > > > Right, but when is it OK for hasPendingActivity() to not check that the > context > > is still live? Is there some guideline here? > > Only that the predicate must transition to |false| eventually to prevent > leaks/retention. I'm not aware of cases where that's not what's wanted, but > haraken@ may have come across some. > > Some implementations have weaker forms of life-end than EOL for the > ExecutionContext, but could the implementations be more regular? Definitely; > looking closer, I think extending ActiveScriptWrappables with an > ExecutionContext member to handle the detached ExecutionContext case, is the way > to go. lgtm, thanks for working on this
On 2016/12/14 19:26:35, sof wrote: > On 2016/12/14 18:29:35, dcheng wrote: > > On 2016/12/14 18:16:40, sof wrote: > > > On 2016/12/14 17:03:11, dcheng wrote: > > > > On 2016/12/14 16:26:33, sof wrote: > > > > > On 2016/12/14 15:56:20, haraken wrote: > ... > > > > > > > > > > Yes, it'd be better if this detail could be kept out of > > hasPendingActivity() > > > > > implementations and instead be provided "for free". Extending all > > > > > ActiveScriptWrappables with an extra field is not "free" for those > > > > > implementations which doesn't override hasPendingActivity(), > > unfortunately. > > > > > > > > > > I've updated the description to make it more accurate. > > > > > > > > This seems a bit fragile. There's a number of places that override this, > and > > > > they all check this slightly differently. It's also hard to tell if > they're > > > > correct just by inspection. For example, > DOMFileSystem::hasPendingActivity() > > > > just check that there are a positive number of callbacks. It's hard for me > > to > > > > tell if that check is correct or not, given this patch. > > > > > > I don't understand what you expect to see. Each object has a different > notion > > of > > > must-stay-alive, that's why they override the default of returning |false|. > > What > > > commonality do you expect to see? > > > > Right, but when is it OK for hasPendingActivity() to not check that the > context > > is still live? Is there some guideline here? We should always check getExecutionContext(). Before enabling the wrapper tracing, we're doing that in V8GCController (https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/...). After enabling the wrapper tracing, we should do that in ActiveScriptWrappable, but we don't yet have that logic. So Sigbjorn is trying to land this CL as a short-term fix. > > Only that the predicate must transition to |false| eventually to prevent > leaks/retention. I'm not aware of cases where that's not what's wanted, but > haraken@ may have come across some. > > Some implementations have weaker forms of life-end than EOL for the > ExecutionContext, but could the implementations be more regular? Definitely; > looking closer, I think extending ActiveScriptWrappables with an > ExecutionContext member to handle the detached ExecutionContext case, is the way > to go.
Ok, LGTM
Description was changed from ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG=658240 ========== to ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG= ==========
I'll get on to that ActiveScriptWrappable change right away, if no one else is busy working on this already.
On 2016/12/15 08:32:21, sof wrote: > I'll get on to that ActiveScriptWrappable change right away, if no one else is > busy working on this already. Thanks!
The CQ bit was checked by sigbjornf@opera.com
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 1, "attempt_start_ts": 1481791792154960, "parent_rev": "c8e73edbf82a563e16340440b995852861fb918a", "commit_rev": "8d0fa0e67ece016c7ca2921a66749e3c52d9e895"}
Message was sent while issue was closed.
Description was changed from ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG= ========== to ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG= Review-Url: https://codereview.chromium.org/2571193002 ==========
Message was sent while issue was closed.
Committed patchset #1 (id:1)
Message was sent while issue was closed.
Description was changed from ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG= Review-Url: https://codereview.chromium.org/2571193002 ========== to ========== Signal no pending activity in destructed contexts. Various hasPendingActivity() overrides weren't taking the state of the ExecutionContext into account, only considering if event listeners were registered. We're not interested in holding onto a script environment after an execution context has been destroyed, so adjust the predicates to return false if the ExecutionContext has been destructed. The V8GCController wrapper visitors already check if hasPendingActivity() implementations incorrectly return |true| when used inside of destroyed ExecutionContexts, but that check is not handled by trace wrappers (ActiveScriptWrappable.) R= BUG= Committed: https://crrev.com/cf43a3b249e837503fad6d815d74346d7a187f84 Cr-Commit-Position: refs/heads/master@{#438787} ==========
Message was sent while issue was closed.
Patchset 1 (id:??) landed as https://crrev.com/cf43a3b249e837503fad6d815d74346d7a187f84 Cr-Commit-Position: refs/heads/master@{#438787} |