-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcontainer: use OwnedFd as console_socket in ContainerBuilder #2966
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @abel-von .
Two of the tests in tty.rs
are failing due to these changes.
Would you mind fixing them?
crates/libcontainer/src/tty.rs
Outdated
@@ -233,7 +221,7 @@ mod tests { | |||
let lis = UnixListener::bind(&socket_path); | |||
assert!(lis.is_ok()); | |||
let fd = setup_console_socket(testdir.path(), &socket_path, CONSOLE_SOCKET); | |||
let status = setup_console(&fd.unwrap()); | |||
let status = setup_console(fd.unwrap().as_raw_fd()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing as setup_console
is closing the RawFd
it receives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, changed to into_raw_fd
Hi @YJDoc2, I think they are independent, we found these issues because we are trying to use libcontainer instead of calling runc binary to manage containers. In our senarios, we have one process in a machine to manage all the containers running on it, so when we call libcontainer to manage containers, we have to make sure no resource residual in this process when a container is removed. |
bb5ade5
to
a267816
Compare
a267816
to
9aa282b
Compare
Signed-off-by: Abel Feng <[email protected]>
9aa282b
to
d460f9c
Compare
Fixed the test if we agree that |
@jprendes I think the test is ok now? could you please check this again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@abel-von , may I ask you to resolve the conflict and maybe rebase on main? Thanks |
Signed-off-by: Yashodhan Joshi <[email protected]>
I did a main merge and resolved this, as it was pretty small. Will merge after CI passes. Thanks for your contribution! |
Very sorry for the late reply, and thank you very much. @YJDoc2 |
We found we will get a residual fd in the process to call libcontainer, after we called exec of a container and exit.
and after some investigation, I found it is because the opened console_socket is not closed after exec build.