-
Notifications
You must be signed in to change notification settings - Fork 14
An API to detect crash inside worker thread #3
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
Comments
Thank you for the feedback!
That's true; and thanks for point this out! It's been a while since 'src/atw.rs' was implemented, and handling the worker's crash cases has been totally forgotten! So I'd be very happy to have such a PR that improves the situation. Regarding the patch, I have some suggestions though. According to the demo, it's really nice that we can trigger the closure made by As far as I tested, the worker is still "alive" even after |
Yeah, that sounds much better than my initial idea. Even better if the thread can be actually reused after a job crashes, though I guess we'll need an experiment for that part. |
I tried copying the body of One major(?) caveat is that every crash inside the thread seems to occupy the memory it was holding. If you repeatedly click the "error" button like 30 or 40 times and then click the "good" button, you get OOM panic on that too. A good news is that it can still be fixed by terminating the thread and starting a new one. I'm honestly not sure how to deal with multiple jobs being run at once. I guess it is probably safe to reject all jobs (as it is now) since other parts of Rust code could be affected by the panic inside the thread. |
Nice to hear that it worked as we expected! (with an interesting caveat 😄 )
Looks related to this issue. So, once https://github.com/WebAssembly/exception-handling becomes available in future, I think we will be able to do something about it (e.g. informing the developer about the ID of the exact panic'ed job, and/or providing a callback interface).
Yeah, and due to the point above, it's likely that the developer ends up calling Now, it looks like we are ready; will you file a PR? |
I guess you can |
Indeed. |
Uh oh!
There was an error while loading. Please reload this page.
I found that the current
Thread
API does not support the situation where the worker crashes while running the given task. (Please correct me if I'm wrong) So I made a patched version inside a small demo app (live version here). The patch adds anonerror
hook to the created JSWorker
instance, and anis_terminated()
method to allow polling if the thread crashed or not.Should I open a PR on this?
The text was updated successfully, but these errors were encountered: