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

Improved error message for Executor::exec #655

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions crates/containerd-shim-wasm/src/sys/unix/container/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,20 @@ impl<E: Engine> Executor<E> {

fn inner(&self, spec: &Spec) -> &InnerExecutor {
self.inner.get_or_init(|| {
if is_linux_container(&self.ctx(spec)).is_ok() {
InnerExecutor::Linux
} else if self.engine.can_handle(&self.ctx(spec)).is_ok() {
InnerExecutor::Wasm
} else {
InnerExecutor::CantHandle
let ctx = &self.ctx(spec);
match is_linux_container(ctx) {
Ok(_) => InnerExecutor::Linux,
Err(err) => {
log::debug!("error checking if linux container: {err}. Fallback to wasm container");
match self.engine.can_handle(ctx) {
Ok(_) => InnerExecutor::Wasm,
Err(err) => {
// log an error and return
log::error!("error checking if wasm container: {err}. Note: arg0 must be a path to a Wasm file");
InnerExecutor::CantHandle
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice if we could pass some context to this error message so it got bubbled up to the CTR/cri error message with out having to look into the logs.

It looks like we pass the name as context, maybe we could extend it take in a message too?

https://github.com/containerd/runwasi/blob/main/crates/containerd-shim-wasm/src/sys/unix/container/executor.rs#L40

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah good point! I was thinking about that. I will make a PR against youki anad see if they like this idea.

}
}
}
}
})
}
Expand Down
Loading