mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-12 13:22:28 +00:00
Merge pull request #11504 from lifupan/fix_fd_leak
agent: fix the issue of parent writer pipe fd leak
This commit is contained in:
commit
75d23b8884
@ -2081,8 +2081,8 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_linuxcontainer_get_process() {
|
||||
#[tokio::test]
|
||||
async fn test_linuxcontainer_get_process() {
|
||||
let _ = new_linux_container_and_then(|mut c: LinuxContainer| {
|
||||
c.processes.insert(
|
||||
1,
|
||||
|
@ -179,6 +179,11 @@ impl Process {
|
||||
p.parent_stdin = Some(pstdin);
|
||||
p.stdin = Some(stdin);
|
||||
|
||||
// Make sure the parent stdin writer be inserted into
|
||||
// p.writes hashmap, thus the cleanup_process_stream can
|
||||
// cleanup and close the parent stdin fd.
|
||||
let _ = p.get_writer(StreamType::ParentStdin);
|
||||
|
||||
// These pipes are necessary as the stdout/stderr of the child process
|
||||
// cannot be a socket. Otherwise, some images relying on the /dev/stdout(stderr)
|
||||
// and /proc/self/fd/1(2) will fail to boot as opening an existing socket
|
||||
@ -308,8 +313,8 @@ mod tests {
|
||||
assert_eq!(max_size, actual_size);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_process() {
|
||||
#[tokio::test]
|
||||
async fn test_process() {
|
||||
let id = "abc123rgb";
|
||||
let init = true;
|
||||
let process = Process::new(
|
||||
|
@ -2623,11 +2623,6 @@ mod tests {
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
TestData {
|
||||
has_fd: false,
|
||||
result: Err(anyhow!(ERR_CANNOT_GET_WRITER)),
|
||||
..Default::default()
|
||||
},
|
||||
];
|
||||
|
||||
for (i, d) in tests.iter().enumerate() {
|
||||
|
Loading…
Reference in New Issue
Block a user