[Webkit-unassigned] [Bug 180499] ASSERTION FAILED: m_workerGlobalScope->hasOneRef()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 13 16:32:13 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=180499

--- Comment #4 from Jiewen Tan <jiewen_tan at apple.com> ---
(In reply to youenn fablet from comment #3)
> Looking at CryptoKeyRSA::generatePair, it does the following:
> - ref the ScriptExecutionContext in a thread T1
> - dispatch to a thread T2
> - execute a task in T2
> - go back to the original thread T1
> - unref the ScriptExecutionContext.
> 
> I do not believe this works in practice since T1 may be stopped when
> executing T2 task.
> Refing the context will not help going back to T1 in that case.
> This is probably why we are hitting that assertion.
> 
> Also, since we might not be able to go back to T1, we should not ref
> anything in the callbacks otherwise, they might be destroyed in the wrong
> thread.
> 
> For instance, SubtleCrypto::generateKey callbacks are capturing promises.
> It might be better to keep a ref of the promise in SubtleCrypto and keep a
> weak ref to it. Then you can probably get SubtleCrypto from the
> ScriptExecutionContext on the way back.

I agreed that this might be the problem. However, I am not sure if it is a good idea to keep a strong ref of the promise within SubtleCrypto. SubtleCrypto is a global object that ties with DOMWindow and WokerGlobalScope. For that solution, we might need a map in SubtleCrypto that holds a bunch of Promises and then somehow can deallocate each when an identifier is passed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171214/ab802424/attachment-0001.html>


More information about the webkit-unassigned mailing list