Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only works in Chrome, due to SharedArrayBuffer requirement #4

Open
agwells opened this issue Jan 5, 2018 · 1 comment
Open

Only works in Chrome, due to SharedArrayBuffer requirement #4

agwells opened this issue Jan 5, 2018 · 1 comment

Comments

@agwells
Copy link
Contributor

agwells commented Jan 5, 2018

As noted in issue #1, all web browsers are disabling the JS SharedArrayBuffer api as a mitigation against the Meltdown and Specter security issues. That prevents this project from working, because it relies on SharedArrayBuffer to synchronously pass data between the TADS process (running in a web worker) and the user interface (in the browser window).

The core of the problem is that JS's main way to pass data back and forth to a web worker, is via the JS event system. In the browser, you do postMessage(), which sends a message event to the web worker, and that tells JS to invoke the onmessage eventhandler method in the web worker (if it's registered).

Where it breaks down for us, is that JS is asynchronous but single-threaded. Even if an onmessage handler is registered in the web worker, it won't actually be executed until any currently-executing methods in the web worker exit. And the tadsr program, as transpiled by emscripten, doesn't exit until the program quits.

We're not the first to encounter this problem. See:

The apparent solutions available are:

None of these are easy to do, however. As noted in the readme, Emterpreter and ASYNCIFY have already been tried. And the emscripten async functions would require a major rewrite of the plygo() method in tads2/ply.c and related I/O functions.

@agwells
Copy link
Contributor Author

agwells commented Nov 12, 2018

Update: Chrome re-enabled SharedArrayBuffer in version 68, which came out in May 2018. So, this project works fine now in Chrome (and Chromium).

@agwells agwells changed the title No longer works because SharedArrayBuffer has been disabled Only works in Chrome, due to SharedArrayBuffer requirement Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant