mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-16 22:39:01 +00:00
Merge pull request #11209 from lifupan/fix_slog
shimv2: fix the issue logger write failed
This commit is contained in:
@@ -11,10 +11,14 @@ use anyhow::{Context, Result};
|
|||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
pub(crate) fn set_logger(path: &str, sid: &str, is_debug: bool) -> Result<slog_async::AsyncGuard> {
|
pub(crate) fn set_logger(path: &str, sid: &str, is_debug: bool) -> Result<slog_async::AsyncGuard> {
|
||||||
|
//it's better to open the log pipe file with read & write option,
|
||||||
|
//otherwise, once the containerd reboot and closed the read endpoint,
|
||||||
|
//kata shim would write the log pipe with broken pipe error.
|
||||||
let fifo = std::fs::OpenOptions::new()
|
let fifo = std::fs::OpenOptions::new()
|
||||||
.custom_flags(libc::O_NONBLOCK)
|
.custom_flags(libc::O_NONBLOCK)
|
||||||
.create(true)
|
.create(true)
|
||||||
.append(true)
|
.read(true)
|
||||||
|
.write(true)
|
||||||
.open(path)
|
.open(path)
|
||||||
.context(Error::FileOpen(path.to_string()))?;
|
.context(Error::FileOpen(path.to_string()))?;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user