Merge pull request #1447 from liubin/liubin/fix-1369

agent: Stop receive message from Receiver if got None
This commit is contained in:
Tim Zhang
2021-02-24 16:48:24 +08:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -191,7 +191,10 @@ async fn register_memory_event(
let content = fs::read_to_string(path.clone());
info!(
sl!(),
"OOM event for container: {}, content: {:?}", &containere_id, content
"cgroup event for container: {}, path: {:?}, content: {:?}",
&containere_id,
&path,
content
);
}
}

View File

@@ -317,7 +317,13 @@ impl Sandbox {
tokio::spawn(async move {
loop {
let event = rx.recv().await;
// None means the container has exited,
// and sender in OOM notifier is dropped.
if event.is_none() {
return;
}
info!(logger, "got an OOM event {:?}", event);
let _ = tx
.send(container_id.clone())
.await