Implement a callback in JS whenever a SharedArrayBuffer is constructed inside a context
Categories
(Core :: JavaScript: WebAssembly, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: bas.schouten, Assigned: lth)
References
Details
Attachments
(1 file)
Whenever a structured clone occurs of a SharedArrayBuffer we need a callback into Gecko so that Gecko may optionally decide to use that for throttling in order to prevent high prevision timer. This is needed for bug 1563335.
Updated•6 years ago
|
Comment 1•6 years ago
|
||
P2 because the bug it blocks is P2. Assuming Bas can take this. If not, needinfo?me.
![]() |
||
Comment 2•6 years ago
|
||
Oops, sorry for forgetting about this. Lars, do you suppose you could help with this?
(I suppose there might also be a need for a callback when a JSContext no longer contains any SABs (so the JSContext no longer needs to be sequentialized). But maybe that's not actually worth the fuss given the rare expected usage of this.)
Assignee | ||
Comment 3•6 years ago
|
||
It shouldn't be hard to do a callback on cloning, there are choke points in StructuredClone.cpp that we can use for both SABs and wasm memories. Do we want a callback when the object is sent, or when it is received, or both? The subject line suggests only on reading (and this sort of makes the most sense); comment 0 is a little more ambiguous.
At the moment, the expected use of this is "never", right? So I probably wouldn't worry about counting the number of live SABs. That said, we already have a mechanism for counting the number of live SABs, it's JS::ContainsSharedArrayBuffer(JSContext*)
. So the SAB finalization mechanism could plausibly use the existing reference count to decide whether to trigger a callback for no more live SABs
.
Assignee | ||
Comment 4•6 years ago
|
||
When structured clone reads a SAB and creates a new SAB object, call a
callback that lets the embedder know. The embedder can then adjust
its policy. Concretely, we want to allow the browser to serialize
threads in a process that uses JS shared memory.
Assignee | ||
Comment 5•6 years ago
|
||
![]() |
||
Comment 6•6 years ago
|
||
Oops, answered in phab comment, but to be clear here: good question, I think we need a callback call on both the sending and receiving sides, so that both JSContexts end up getting serialized.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 8•5 years ago
|
||
Backed out changeset 1dc5c3074b57 (Bug 1609916) for causing spidermonkey bustage
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=287946169&repo=autoland&lineNumber=12698
[task 2020-02-07T16:22:11.776Z] TEST-PASS | js/src/jit-test/tests/wasm/ion-lazy-tables.js | Success (code 0, args "--disable-wasm-huge-memory") [0.9 s]
[task 2020-02-07T16:22:11.874Z] /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:11.874Z] Stack:
[task 2020-02-07T16:22:11.874Z] @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:11.874Z] Exit code: 3
[task 2020-02-07T16:22:11.874Z] FAIL - wasm/memory-cloning.js
[task 2020-02-07T16:22:11.875Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/memory-cloning.js | /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated) (code 3, args "") [0.3 s]
[task 2020-02-07T16:22:11.875Z] INFO exit-status : 3
[task 2020-02-07T16:22:11.875Z] INFO timed-out : False
[task 2020-02-07T16:22:11.875Z] INFO stderr 2> /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:11.875Z] INFO stderr 2> Stack:
[task 2020-02-07T16:22:11.875Z] INFO stderr 2> @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:11.895Z] TEST-PASS | js/src/jit-test/tests/wasm/memory-aliasing.js | Success (code 0, args "--disable-wasm-huge-memory") [0.3 s]
[task 2020-02-07T16:22:11.975Z] /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:11.976Z] Stack:
[task 2020-02-07T16:22:11.976Z] @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:11.977Z] Exit code: 3
[task 2020-02-07T16:22:11.977Z] FAIL - wasm/memory-cloning.js
[task 2020-02-07T16:22:11.977Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/memory-cloning.js | /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated) (code 3, args "--wasm-compiler=ion") [0.4 s]
[task 2020-02-07T16:22:11.977Z] INFO exit-status : 3
[task 2020-02-07T16:22:11.977Z] INFO timed-out : False
[task 2020-02-07T16:22:11.977Z] INFO stderr 2> /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:11.977Z] INFO stderr 2> Stack:
[task 2020-02-07T16:22:11.977Z] INFO stderr 2> @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.003Z] /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.003Z] Stack:
[task 2020-02-07T16:22:12.003Z] @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.003Z] Exit code: 3
[task 2020-02-07T16:22:12.003Z] FAIL - wasm/memory-cloning.js
[task 2020-02-07T16:22:12.003Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/memory-cloning.js | /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated) (code 3, args "--test-wasm-await-tier2") [0.4 s]
[task 2020-02-07T16:22:12.004Z] INFO exit-status : 3
[task 2020-02-07T16:22:12.004Z] INFO timed-out : False
[task 2020-02-07T16:22:12.004Z] INFO stderr 2> /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.004Z] INFO stderr 2> Stack:
[task 2020-02-07T16:22:12.004Z] INFO stderr 2> @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.007Z] /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.007Z] Stack:
[task 2020-02-07T16:22:12.007Z] @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.007Z] Exit code: 3
[task 2020-02-07T16:22:12.007Z] FAIL - wasm/memory-cloning.js
[task 2020-02-07T16:22:12.007Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/memory-cloning.js | /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated) (code 3, args "--disable-wasm-huge-memory") [0.3 s]
[task 2020-02-07T16:22:12.007Z] INFO exit-status : 3
[task 2020-02-07T16:22:12.007Z] INFO timed-out : False
[task 2020-02-07T16:22:12.007Z] INFO stderr 2> /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.007Z] INFO stderr 2> Stack:
[task 2020-02-07T16:22:12.007Z] INFO stderr 2> @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.010Z] TEST-PASS | js/src/jit-test/tests/wasm/memory-sharing-off.js | Success (code 0, args "--shared-memory=off --wasm-compiler=baseline") [0.3 s]
[task 2020-02-07T16:22:12.013Z] /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.013Z] Stack:
[task 2020-02-07T16:22:12.013Z] @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
[task 2020-02-07T16:22:12.013Z] Exit code: 3
[task 2020-02-07T16:22:12.013Z] FAIL - wasm/memory-cloning.js
[task 2020-02-07T16:22:12.014Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/memory-cloning.js | /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated) (code 3, args "--wasm-compiler=baseline") [0.4 s]
[task 2020-02-07T16:22:12.014Z] INFO exit-status : 3
[task 2020-02-07T16:22:12.014Z] INFO timed-out : False
[task 2020-02-07T16:22:12.014Z] INFO stderr 2> /builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27 InternalError: bad serialized structured data (truncated)
[task 2020-02-07T16:22:12.014Z] INFO stderr 2> Stack:
[task 2020-02-07T16:22:12.014Z] INFO stderr 2> @/builds/worker/workspace/build/src/js/src/jit-test/tests/wasm/memory-cloning.js:27:27
Assignee | ||
Comment 9•5 years ago
|
||
Oh, that's very fascinating, this change should have had no functional effects...
Assignee | ||
Comment 10•5 years ago
|
||
Bad parens for a factored expression.
Updated•5 years ago
|
Comment 11•5 years ago
•
|
||
:lth, this mochitests failures seem to be from that push as well:
https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=287948819&searchStr=mochitest&revision=1dc5c3074b57fb45d0a94188e69048da993360ca
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=287948819&repo=autoland&lineNumber=7172
[task 2020-02-07T16:47:43.121Z] 16:47:43 INFO - TEST-START | dom/worklet/tests/test_audioWorklet_WASM.html
[task 2020-02-07T16:47:43.190Z] 16:47:43 INFO - GECKO(3508) | [Child 3564, Main Thread] WARNING: Trying to request nsIHttpChannel from DocumentChannel, this is likely broken: file /builds/worker/workspace/build/src/netwerk/ipc/DocumentChannel.cpp, line 63
[task 2020-02-07T16:47:43.306Z] 16:47:43 INFO - GECKO(3508) | [Child 3564, Main Thread] WARNING: Trying to request nsIHttpChannel from DocumentChannel, this is likely broken: file /builds/worker/workspace/build/src/netwerk/ipc/DocumentChannel.cpp, line 63
[task 2020-02-07T16:47:45.577Z] 16:47:45 INFO - GECKO(3508) | [Child 3564, GraphRunner] WARNING: 'rv.Failed()', file /builds/worker/workspace/build/src/dom/messagechannel/MessagePort.cpp, line 137
[task 2020-02-07T16:53:06.785Z] 16:53:06 INFO - TEST-INFO | started process screentopng
[task 2020-02-07T16:53:06.926Z] 16:53:06 INFO - TEST-INFO | screentopng: exit 0
[task 2020-02-07T16:53:06.927Z] 16:53:06 INFO - Buffered messages logged at 16:47:45
[task 2020-02-07T16:53:06.927Z] 16:53:06 INFO - Checking if we can play with WebAssembly...
[task 2020-02-07T16:53:06.927Z] 16:53:06 INFO - TEST-PASS | dom/worklet/tests/test_audioWorklet_WASM.html | WebAssembly object should exist
[task 2020-02-07T16:53:06.928Z] 16:53:06 INFO - TEST-PASS | dom/worklet/tests/test_audioWorklet_WASM.html | WebAssembly.compile function should exist
[task 2020-02-07T16:53:06.928Z] 16:53:06 INFO - TEST-PASS | dom/worklet/tests/test_audioWorklet_WASM.html | The WasmModule has been compiled.
[task 2020-02-07T16:53:06.928Z] 16:53:06 INFO - TEST-PASS | dom/worklet/tests/test_audioWorklet_WASM.html | WasmModule received
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - Buffered messages finished
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - TEST-UNEXPECTED-FAIL | dom/worklet/tests/test_audioWorklet_WASM.html | Test timed out.
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - SimpleTest.ok@https://example.com/tests/SimpleTest/SimpleTest.js:277:18
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - reportError@https://example.com/tests/SimpleTest/TestRunner.js:121:22
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:142:18
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.929Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.930Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.931Z] 16:53:06 INFO - setTimeout handler*TestRunner._checkForHangs@https://example.com/tests/SimpleTest/TestRunner.js:170:15
[task 2020-02-07T16:53:06.931Z] 16:53:06 INFO - TestRunner.runTests/<@https://example.com/tests/SimpleTest/TestRunner.js:388:20
[task 2020-02-07T16:53:06.931Z] 16:53:06 INFO - promise callback*TestRunner.runTests@https://example.com/tests/SimpleTest/TestRunner.js:375:50
[task 2020-02-07T16:53:06.931Z] 16:53:06 INFO - RunSet.runtests@https://example.com/tests/SimpleTest/setup.js:201:14
[task 2020-02-07T16:53:06.932Z] 16:53:06 INFO - RunSet.runall@https://example.com/tests/SimpleTest/setup.js:180:12
[task 2020-02-07T16:53:06.933Z] 16:53:06 INFO - hookupTests@https://example.com/tests/SimpleTest/setup.js:273:12
[task 2020-02-07T16:53:06.933Z] 16:53:06 INFO - parseTestManifest@https://example.com/manifestLibrary.js:48:13
[task 2020-02-07T16:53:06.933Z] 16:53:06 INFO - getTestManifest/req.onload@https://example.com/manifestLibrary.js:61:28
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Likely the same problem. Anyway, if it doesn't work please back it out, and I'll get to it whenever.
Comment 14•5 years ago
|
||
Backed out for Hazzard bustages.
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=287955471&repo=autoland&lineNumber=9889
Backout: https://hg.mozilla.org/integration/autoland/rev/46c78853b2f56e4cc0c9130929706d991aa11463
Assignee | ||
Comment 15•5 years ago
|
||
Hazard was a brain fart, fixed: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8ec054849c7c793458ec407dbdb0f04d57872c31
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Description
•