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

Fix stop after EOF error condition #1654

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

Conversation

mgjm
Copy link
Contributor

@mgjm mgjm commented Aug 29, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

While implementing attach for podman the attach stream would never terminate (at least without setting cfg.StopAfterStdinEOF, but then it would not wait for all output).

This change fixes this issue in my case, but it might be the wrong fix. Maybe it should instead be just the following:

if er == io.EOF {
    return nil
}

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Signed-off-by: Martin Michaelis <code@mgjm.de>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 29, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mgjm
Once this PR has been reviewed and has the lgtm label, please assign saschagrunert for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -270,7 +270,7 @@ func (c *ConmonClient) redirectResponseToOutputStreams(
return nil
}
}
if er == io.EOF || (cfg.ContainerStdin && !cfg.StopAfterStdinEOF) {
if er == io.EOF && cfg.ContainerStdin && !cfg.StopAfterStdinEOF {
Copy link
Member

Choose a reason for hiding this comment

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

Hm, we have to test if this works with CRI-O, I know we had some issues with that in the past.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The more I think about it, it probably should just be

if er == io.EOF {
    return nil
}

Copy link
Member

Choose a reason for hiding this comment

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

cfg.ContainerStdin && !cfg.StopAfterStdinEOF feels like a workaround, is that related to #1655?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Likely we need to detect the EOF and then drain the streams.

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.

None yet

3 participants