Skip to content

[css-paint][isolated-workers] What happens if a script throws? #43

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

Closed
FremyCompany opened this issue Sep 14, 2015 · 4 comments
Closed

Comments

@FremyCompany
Copy link
Contributor

This could have an impact on other scripts running in the background worker.
Should we restart the environement after such an error or not?

That's important to know for scripts which may want to share data because if the worker can be restarted during a single-frame step, there's no way to accurately pass information from one script to another (or one run to another).

@tabatkins
Copy link
Member

This could have an impact on other scripts running in the background worker.
Should we restart the environement after such an error or not?

Why would that be necessary? Errors don't corrupt the scripting environment, they just tear down the call stack until they're caught (or land at the top scripting context). An error will just invalidate that particular call; the next one will start fresh.

That's important to know for scripts which may want to share data because if the worker can be restarted during a single-frame step, there's no way to accurately pass information from one script to another (or one run to another).

Workers can be restarted in a single frame step; they can be restarted arbitrarily. Between every single invocation, possibly. There is no reliable way to "stash" information between calls, and we're actively seeking to require low-impact ways to make this less reliable, like using a pool of contexts and randomly switching between them between calls.

@FremyCompany
Copy link
Contributor Author

The issue I had in mind is that the script being stopped at some random point in execution may leave a buggy environment around it (globals or scope-local globals incorrectly set, caches filled with buggy values, etc...), which may cause ulterior failures.

Maybe I'm overthinking this issue though, but I wanted to make sure someone else gave it some thought, too.

@tabatkins
Copy link
Member

Your script shouldn't be messing with the global environment in the first place; doing it at all is a mistake, and if you fuck yourself up by getting an error before you can clean up, that's your own fault.

@FremyCompany
Copy link
Contributor Author

Ok, good pooint

majido pushed a commit to majido/css-houdini-drafts that referenced this issue Aug 8, 2018
Initial draft of AnimationWorklet spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants