Skip to content

Commit

Permalink
Fixed layer making process zombie by calling panic from hookerror (#2370
Browse files Browse the repository at this point in the history
)

* Fixed layer making process zombie by calling panic from hookerror

* sigkill
  • Loading branch information
aviramha authored Apr 11, 2024
1 parent 24cc3eb commit 5796d4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/+fix-panic.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed layer making process zombie by calling panic from hookerror, also use `sigkill` instead of `sigterm`
5 changes: 3 additions & 2 deletions mirrord/layer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl From<HookError> for i64 {
HookError::SocketUnsuportedIpv6 => {
info!("{fail}")
}
HookError::ProxyError(err) => {
HookError::ProxyError(ref err) => {
graceful_exit!(
"Proxy error, connectivity issue or a bug. \n\
You may report it to us on https://github.com/metalbear-co/mirrord/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml \n{err}"
Expand Down Expand Up @@ -263,7 +263,8 @@ impl From<HookError> for i64 {
err @ ResponseError::Forbidden { .. } => {
graceful_exit!(
"Stopping mirrord run. Please adjust your mirrord configuration.\n{err}"
)
);
libc::EINVAL
}
},
HookError::DNSNoName => libc::EFAULT,
Expand Down
5 changes: 2 additions & 3 deletions mirrord/layer/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ macro_rules! graceful_exit {
() => {{
nix::sys::signal::kill(
nix::unistd::Pid::from_raw(std::process::id() as i32),
nix::sys::signal::Signal::SIGTERM,
nix::sys::signal::Signal::SIGKILL,
)
.expect("unable to graceful exit");
panic!()
.expect("unable to graceful exit")
}};
}

Expand Down

0 comments on commit 5796d4a

Please sign in to comment.