-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve isolate error handling (#1451)
<!-- Please make sure there is an issue that this PR is correlated to. --> Fixes RVT-4173 Fixes RVT-4175 Fixes RVT-4178 Fixes RVT-4180 ## Changes <!-- If there are frontend changes, please include screenshots. -->
- Loading branch information
1 parent
f4e2f42
commit 47d01df
Showing
9 changed files
with
209 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Error handling | ||
|
||
There are several layers of error handling in the isolate runner. Going from the isolate runtime to the main | ||
thread: | ||
|
||
1. Js runtime errors are caught in various places in `run_inner` in `src/isolate.rs`. These are written to the | ||
stderr log stream and visible to users on the dashboard. No error is thrown from the function. | ||
2. Errors besides js runtime errors are thrown by `run_inner` and caught by `run`. An error line is written to | ||
the stderr log stream stating that a fatal error has occurred. An error code of 1 is returned by the `run` | ||
function and no error is thrown by `run`. | ||
3. If any error is thrown by the `run` function (likely during setup or cleanup), it is caught by the tokio | ||
task (in `src/main.rs`) which is watching the thread where the `run` function is running from. Upon any | ||
error, it logs the error and sends a message to the `fatal_tx` channel. | ||
4. The `main` function in `src/main.rs` is a `tokio::select!` on the WS retry loop and `fatal_tx`. If any | ||
message is received on `fatal_tx`, an error code of 1 is written and the program throws "Fatal error". | ||
5. Besides messages from `fatal_tx`, the main function can fail during setup (redirecting logs, reading | ||
config, writing pid, etc) or from fatal errors from the WS connection. This includes bad packets or failed | ||
socket sends. It is intended to fail for these cases, but should automatically handle retryable errors like | ||
the socket closing. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.