observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

SharedArrayBuffer support #615

Closed tomlarkworthy closed 5 months ago

tomlarkworthy commented 5 months ago

Is your feature request related to a problem? Please describe. Synchronous cross worker function call emulation is not possible without SharedArrayBuffer, Atomics.wait(), Atomics.notify(). We do not have the required response headers on the content document

"Cross-Origin-Opener-Policy": "same-origin"
"Cross-Origin-Embedder-Policy": "require-corp"

These are needed to get WASI working. To emulate blocking access to filesystem handles, the WASM worker needs to be paused until JS has a response, and thus the need for Atomics over shared buffers is born. See https://github.com/wasmerio/wasmer-js

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

mootari commented 5 months ago

There was a similar discussion for WebR when it still required SharedArrayBuffer, and this issue is essentially a duplicate of #532.

Last time I investigated this my conclusion was that it's simply not possible with Observable's sandbox architecture. I'm going to close this issue for now, but happy to reopen if I'm proven wrong. 🙂

If you like you can give it a shot by overriding headers via Chrome DevTools.

tomlarkworthy commented 5 months ago

yes its the same issue. I saw those were motivated by R though and solved a different way. This is a blocker for WASI though. Maybe not possible to fix in any sane way though.