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

remote exec: write conmon error on hijacked connection #9105

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Jan 26, 2021

Make sure to write error from conmon on the hijacked http connection.
This fixes issues where errors were not reported on the client side,
for instance, when specified command was not found on the container.

To future generations: I am sorry. The code is complex, and there are
many interdependencies among the concurrent goroutines. I added more
complexity on top but I don't have a good idea of how to reduce
complexity in the available time.

Fixes: #8281
Signed-off-by: Valentin Rothberg rothberg@redhat.com

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 26, 2021
@edsantiago
Copy link
Member

Thank you!

@vrothberg
Copy link
Member Author

@edsantiago this might be it. The code is tricky ... lot's of spaghetti dependencies and I didn't help making it simpler. I'll have another look tomorrow morning with a fresh pair of eyes in hope to find a simpler solution without larger refactorings

@edsantiago
Copy link
Member

Flake #8972, restarted

Make sure to write error from conmon on the hijacked http connection.
This fixes issues where errors were not reported on the client side,
for instance, when specified command was not found on the container.

To future generations: I am sorry.  The code is complex, and there are
many interdependencies among the concurrent goroutines.  I added more
complexity on top but I don't have a good idea of how to reduce
complexity in the available time.

Fixes: containers#8281
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
@vrothberg vrothberg changed the title WIP - fix 8281 remote exec: write conmon error on hijacked connection Jan 27, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 27, 2021
@vrothberg
Copy link
Member Author

@containers/podman-maintainers PTAL, ready to merge from my side.

// Many things happen concurrently and yet are interdependent.
// If you ever change this function, make sure to write to the
// conmonPipeDataChan in case of an error.

Copy link
Member

@rhatdan rhatdan Jan 27, 2021

Choose a reason for hiding this comment

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

Would it be more elegant to catch the errors and do the conmonPipeData once?

defer func() { 
      if Err != nil {
 		conmonPipeDataChan <- conmonPipeData{-1, Err}
                return Err
     }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately that doesn't work unless we introduce another (thread safe) variable that would allow us to know whether we already wrote to the channel.

I can try to make it nicer if you want to.

Copy link
Member

Choose a reason for hiding this comment

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

I just worry abour a future deveopers adding a return error and not doing writing to the pipe. For now, I will merge.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, vrothberg

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

The pull request process is described 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

@rhatdan
Copy link
Member

rhatdan commented Jan 27, 2021

LGTM
@containers/podman-maintainers PTAL

@mheon
Copy link
Member

mheon commented Jan 27, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2021
@openshift-merge-robot openshift-merge-robot merged commit 1814fa2 into containers:master Jan 27, 2021
@vrothberg vrothberg deleted the fix-8281 branch January 28, 2021 08:07
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression: podman-remote exec: no stderr
6 participants