Skip to content

cli: container: remove logging in wait-for-exit paths #1731

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cyphar
Copy link
Contributor

@cyphar cyphar commented Mar 12, 2019

The wait code can output log messages, which can end up with you seeing
"errors" due to not being able to get the exit code, when in reality the
context is timing our or being cancelled. I'm not sure how common this
is on x86, but I can see it all the time on arm64 -- and these error
messages seem quite noisy to me (they also cause the integration-cli
tests to become quite flaky in my testing).

Signed-off-by: Aleksa Sarai asarai@suse.de

@cyphar
Copy link
Contributor Author

cyphar commented Mar 12, 2019

This is touching some historically hairy code, sorry for awakening this beast again. :P

@codecov-io
Copy link

Codecov Report

Merging #1731 into master will decrease coverage by <.01%.
The diff coverage is 40%.

@@            Coverage Diff             @@
##           master    #1731      +/-   ##
==========================================
- Coverage   56.14%   56.13%   -0.01%     
==========================================
  Files         306      306              
  Lines       21033    21035       +2     
==========================================
  Hits        11809    11809              
- Misses       8369     8370       +1     
- Partials      855      856       +1

@thaJeztah
Copy link
Member

Oh boy, this is indeed some hairy code; wondering if legacyWaitExitOrRemoved is still needed in this situation?

@cpuguy83 @mlaventure ptal

The wait code can output log messages, which can end up with you seeing
"errors" due to not being able to get the exit code, when in reality the
context is timing our or being cancelled. I'm not sure how common this
is on x86, but I can see it all the time on arm64 -- and these error
messages seem quite noisy to me (they also cause the integration-cli
tests to become quite flaky in my testing).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
@thaJeztah
Copy link
Member

@cpuguy83 ptal

statusChan := waitExitOrRemoved(ctx, dockerCli, createResponse.ID, copts.autoRemove)
// We don't need to wait if we're not attaching.
var statusChan <-chan int
if attach {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if attach is right here, but I really don't understand config.Attach* at all anyway. Right now we might get a panic if you do -a stdin (or in some of the error paths) because we might read from a nil chan -- but I don't see a nice way of solving that.

A simpler way of stopping the issue behind this problem is to just drop the logging code from waitExitOrRemoved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading from a nil chain would block forever, not panic.
So we either need another if attach before reading below (so as not to block forever) or make a channel and close it...

I agree waitExitOrRemoved should not be logging.
It could return a channel can handle both exit status and error messages.

I think removing logging, or some way to gate logging, might be a better approach.

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

Successfully merging this pull request may close these issues.

5 participants