Skip to content

fix(plugin_call): set rc to EXIT_SIGNALED_SIGABRT when wasmtime bails out on plugin call #776

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

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

G4Vi
Copy link
Contributor

@G4Vi G4Vi commented Oct 9, 2024

Fixes #775

134/EXIT_SIGNALED_SIGABRT was chosen as the wasmtime CLI exits with it executes unreachable.

If it would be preferable, I could make the modification just to extism_plugin_call_with_host_context instead.

@G4Vi G4Vi requested a review from zshipko October 9, 2024 22:19
zshipko
zshipko previously approved these changes Oct 9, 2024
Copy link
Contributor

@zshipko zshipko left a comment

Choose a reason for hiding this comment

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

Looks good! One comment, but feel free to ignore it.

} else if let Err(e) = &res {
if e.is::<wasmtime::Trap>() {
rc = 134; // EXIT_SIGNALED_SIGABRT
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should do something like:

Suggested change
}
} else if rc == 0 {
rc = -1;
}

in case it's possible for there to be another case where an error is returned but rc == 0. But maybe that's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In bf95d06 I reworked it to default to -1 and avoid hiding errors that can happen first. Extism errors can happen before wasmtime errors, which happen before retrieving output errors.

@G4Vi G4Vi merged commit a91846a into main Oct 10, 2024
5 checks passed
@G4Vi G4Vi deleted the fix-libextism-unreachable branch October 10, 2024 19:04
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.

libextism extism_plugin_call sometimes returns 0 on error.
2 participants