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 log non-zero exit status codes #128

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Conversation

cratelyn
Copy link
Contributor

@cratelyn cratelyn commented Feb 10, 2022

if a program invokes e.g., std::process:exit(0), this should not cause
confusing messages as reported in #127:

  Jan 1 00:00:00.123 ERROR viceroy_lib::execute: WebAssembly huhu: Exited with i32 exit status 0
wasm backtrace:
    0: 0x280ea - <unknown>!__wasi_proc_exit
    1: 0x280f6 - <unknown>!_Exit

apologies for the lack of test coverage here.

this is unfortunately difficult to test, because the
Result<(), ExecutionError> of ExecuteCtx::run_guest is spawned in a
task that we do not join on later. (note: that is intentional)

the alternative of a test that checks for a particular log message felt
brittle, and this is a relatively straightfoward change.

@cratelyn cratelyn self-assigned this Feb 10, 2022
@cratelyn cratelyn force-pushed the katie/zero-exit-status-code branch from 549b027 to c4f7d0a Compare February 10, 2022 20:40
@cratelyn cratelyn marked this pull request as ready for review February 10, 2022 20:41
event!(Level::ERROR, "WebAssembly trapped: {}", trap);
// Be sure that we only log non-zero status codes.
if trap.i32_exit_status() != Some(0) {
event!(Level::ERROR, "WebAssembly huhu: {}", trap);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM except that I don't know what "huhu" is, was it intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not intended, thank you for catching this! i've force pushed a fresh commit (and commit message) that doesn't include my silly testing string 😅

@cratelyn cratelyn force-pushed the katie/zero-exit-status-code branch 2 times, most recently from 34a312b to bf33880 Compare February 11, 2022 17:18
@cratelyn
Copy link
Contributor Author

sigh. i have a sneaking suspicion that dac94ad is related to the CI failure here.

i don't see this failure when running cargo clippy myself, but i'll disclaim that i am running on a linux box. 😔

if a program invokes e.g., `std::process:exit(0)`, this should not cause
confusing diagnostic messages as reported in #127:

```
  Jan 1 00:00:00.123 ERROR viceroy_lib::execute: WebAssembly trapped: Exited with i32 exit status 0
wasm backtrace:
    0: 0x280ea - <unknown>!__wasi_proc_exit
    1: 0x280f6 - <unknown>!_Exit
```

this is unfortunately difficult to test, because the
`Result<(), ExecutionError>` of `ExecuteCtx::run_guest` is spawned in a
task that we do not join on later. (note: that is intentional)

the alternative of a test that checks for a particular log message felt
brittle, and this is a relatively straightfoward change.
@cratelyn cratelyn force-pushed the katie/zero-exit-status-code branch from bf33880 to 5996ed9 Compare February 11, 2022 19:36
@cratelyn cratelyn merged commit e7ca791 into main Feb 11, 2022
@cratelyn cratelyn deleted the katie/zero-exit-status-code branch February 11, 2022 20:28
@acfoltzer acfoltzer mentioned this pull request Feb 15, 2022
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

Successfully merging this pull request may close these issues.

2 participants