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

mainloop: capture output of short-lived init procs #2062

Merged
merged 5 commits into from Dec 30, 2017

Conversation

2 participants
@brauner
Member

brauner commented Dec 25, 2017

The handler for the signal fd will detect when the init process of a container
has exited and cause the mainloop to close. However, this can happen before the
console handlers - or any other events for that matter - are handled. So in the
case of init exiting we still need to allow for all other pending events to be
handled before exiting. This allows us to capture output from short-lived init
processes.

Closes #1694.

Signed-off-by: Christian Brauner christian.brauner@ubuntu.com

brauner added some commits Dec 25, 2017

mainloop: add mainloop macros
This makes it clearer why handlers return what value.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
mainloop: capture output of short-lived init procs
The handler for the signal fd will detect when the init process of a container
has exited and cause the mainloop to close. However, this can happen before the
console handlers - or any other events for that matter - are handled. So in the
case of init exiting we still need to allow for all buffered input to the
console to be handled before exiting. This allows us to capture output from
short-lived init processes.

This is conceptually equivalent to my implementation of ExecReaderToChannel()
https://github.com/lxc/lxd/blob/master/shared/util_linux.go#L527

Closes #1694.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>

@brauner brauner requested a review from hallyn Dec 27, 2017

@hallyn

This comment has been minimized.

Show comment
Hide comment
@hallyn

hallyn Dec 30, 2017

Member

Sorry for being dense - what is the implication of dropping the timeout_ms check?

Member

hallyn commented on src/lxc/mainloop.c in 3c319ed Dec 30, 2017

Sorry for being dense - what is the implication of dropping the timeout_ms check?

This comment has been minimized.

Show comment
Hide comment
@brauner

brauner Dec 30, 2017

Member
Member

brauner replied Dec 30, 2017

brauner added some commits Dec 26, 2017

start: properly cleanup mainloop
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
console: do not allow non-pty devices on open()
We don't allow non-pty devices anyway so don't let open() create unneeded
files.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
mainloop: use epoll_create1(EPOLL_CLOEXEC)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
@brauner

This comment has been minimized.

Show comment
Hide comment
@brauner

brauner Dec 30, 2017

Member

@hallyn, fixed the issues should be good to go.

Member

brauner commented Dec 30, 2017

@hallyn, fixed the issues should be good to go.

@hallyn hallyn merged commit 2b33c8b into lxc:master Dec 30, 2017

4 checks passed

Branch target Branch target is correct
Details
Signed-off-by All commits signed-off
Details
Testsuite Testsuite passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@hallyn

This comment has been minimized.

Show comment
Hide comment
@hallyn

hallyn Dec 30, 2017

Member

Thanks.

Member

hallyn commented Dec 30, 2017

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment