mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
grpc: fix the issue of crash agent when didn't find the process
It's better to catch the error of couldn't find the process in tty_win_resize service, other wise, an invalid process id could crash the agent. Fixes: #137 Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
This commit is contained in:
parent
e2c9426ebf
commit
289d61730c
@ -926,7 +926,19 @@ impl protocols::agent_grpc::AgentService for agentService {
|
||||
let eid = req.exec_id.clone();
|
||||
let s = Arc::clone(&self.sandbox);
|
||||
let mut sandbox = s.lock().unwrap();
|
||||
let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false).unwrap();
|
||||
let p = match find_process(&mut sandbox, cid.as_str(), eid.as_str(), false) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
let f = sink
|
||||
.fail(RpcStatus::new(
|
||||
RpcStatusCode::InvalidArgument,
|
||||
Some(format!("invalid argument: {}", e)),
|
||||
))
|
||||
.map_err(|_e| error!(sl!(), "invalid argument"));
|
||||
ctx.spawn(f);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if p.term_master.is_none() {
|
||||
let f = sink
|
||||
|
Loading…
Reference in New Issue
Block a user