Skip to content
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

Send to copyDone when err == nil #767

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

Conversation

Kern--
Copy link
Contributor

@Kern-- Kern-- commented Sep 21, 2023

Issue #, if available:

Description of changes:
The ioproxy helps copy container logs from the normal container fifos to the firecracker uvm's vsock. The copying happens in a go-routine and when complete, it send a notification over the copyDone channel to signal to the agent/runtime to cleanup the ioproxy.

This change fixes a bug where, if the iopoxy copy finished without an error (i.e. io.CopyBuffer got an EOF from the read end), the copyDone channel was not notified leaving the ioproxy connected to the vsock, but not the container. This change always notifies copyDone when the copy finishes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The ioproxy helps copy container logs from the normal container fifos to
the firecracker uvm's vsock. The copying happens in a go-routine and
when complete, it send a notification over the `copyDone` channel to
signal to the agent/runtime to cleanup the ioproxy.

This change fixes a bug where, if the iopoxy copy finished without an
error (i.e. `io.CopyBuffer` got an `EOF` from the read end), the
`copyDone` channel was not notified leaving the ioproxy connected to the
vsock, but not the container. This change always notifies `copyDone`
when the copy finishes.

Signed-off-by: Kern Walster <[email protected]>
@Kern-- Kern-- requested a review from a team as a code owner September 21, 2023 00:34
}
copyDone <- err
Copy link
Contributor

Choose a reason for hiding this comment

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

qq: we close the copyDone channel regardless of whether the copy succeeds or fails. Shouldn't that indicate the runtime to clean up the ioproxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yes. I missed that. Using the debug logs from #766 we actually don't see the "copied %d" message from

logger.Debugf("copied %d", size)
which seems like we're actually still stuck in the io.CopyBuffer?

Copy link
Contributor

@swagatbora90 swagatbora90 Sep 22, 2023

Choose a reason for hiding this comment

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

Do you see the copied message with your change to explicitly send an error?

this is where we wait for an error in the copy channel. I assumed this should return nil once we close the channel.

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

Successfully merging this pull request may close these issues.

3 participants