Skip to content

Conversation

@kevpar
Copy link
Member

@kevpar kevpar commented May 11, 2021

The shim is expected to close its end of the IO pipes from the gcs when
it is done using them. This is done to ensure that no data is left
buffered in the pipes on the gcs's end. Previously, this was
accomplished via the ioChannel closing its underlying connection if Read
returned EOF.

However, this is not sufficiently robust, as it will not work in cases
where the shim's IO relay breaks on the write end (e.g. if CRI has gone
away).

To resolve this, we now expose individual methods on cow.Process to
close each IO pipe (in/out/err), and call those from the Cmd
implementation once the IO relay completes.

This should be a good first-pass fix here, until we can apply some more
focused cleanup to the IO relay code in the future.

Some minor renaming/cleanup as well.

Signed-off-by: Kevin Parsons [email protected]

@kevpar kevpar requested a review from a team as a code owner May 11, 2021 17:27
Copy link
Contributor

@msscotb msscotb left a comment

Choose a reason for hiding this comment

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

lgtm pending the jobcontainer and localprocess commnet

@kevpar kevpar force-pushed the close-stdio branch 3 times, most recently from 84bd2fa to 81f652e Compare May 13, 2021 09:13
@kevpar
Copy link
Member Author

kevpar commented May 13, 2021

I added a change to set cmd.Log at initialization, to avoid some nil dereference errors we were seeing in the tests.

return p.stdout.Close()
}

// CloseStderr closes the stdin pipe of the process.
Copy link
Contributor

Choose a reason for hiding this comment

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

closes the stderr pipe*

Copy link
Contributor

@dcantah dcantah left a comment

Choose a reason for hiding this comment

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

lgtm, quick comment fix

The shim is expected to close its end of the IO pipes from the gcs when
it is done using them. This is done to ensure that no data is left
buffered in the pipes on the gcs's end. Previously, this was
accomplished via the ioChannel closing its underlying connection if Read
returned EOF.

However, this is not sufficiently robust, as it will not work in cases
where the shim's IO relay breaks on the write end (e.g. if CRI has gone
away).

To resolve this, we now expose individual methods on cow.Process to
close each IO pipe (in/out/err), and call those from the Cmd
implementation once the IO relay completes.

This should be a good first-pass fix here, until we can apply some more
focused cleanup to the IO relay code in the future.

Some minor renaming/cleanup as well.

Signed-off-by: Kevin Parsons <[email protected]>
@dcantah
Copy link
Contributor

dcantah commented May 13, 2021

lgtm again, thanks!

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