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 remotecommand stream blocked forever problems. #96837

Merged
merged 1 commit into from Dec 10, 2020

Conversation

adamzhoul
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:

function blocked forever while it should exit

    func (p *streamProtocolV4) stream(conn streamCreator) error {

the bug is:

1. p.copyStdout(&wg)   return, but still have a lot of packet in the connection.  
2. watchErrorStream blocked.   because the connection is blocked by the stdout packet. 
3. the goroutine blocked because of this. It should get the error msg and exit.

why copyStdout return, but still have a lot of packets unconsumed?
check the code:

func (p *streamProtocolV2) copyStdout(wg *sync.WaitGroup) {
 ...
    if _, err := io.Copy(p.Stdout, p.remoteStdout); err != nil {
        runtime.HandleError(err)
    }
 ...
}

Check the code above:
p.remoteStdout may have problems, so the function return.
But p.Stdout still have data

So, we need to discard output data, to close the connection. Because it's finished.

Which issue(s) this PR fixes:

Fixes # #96339

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 24, 2020
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 24, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @adamzhoul!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 24, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @adamzhoul. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. labels Nov 24, 2020
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 24, 2020
@adamzhoul
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 24, 2020
@k8s-ci-robot
Copy link
Contributor

@adamzhoul: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@fedebongio
Copy link
Contributor

/assign @yliaog
/cc @caesarxuchao
/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Nov 24, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 24, 2020
@yliaog
Copy link
Contributor

yliaog commented Nov 27, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 27, 2020
@yliaog
Copy link
Contributor

yliaog commented Nov 27, 2020

thanks for the pr. please add a test to verify the fix.

@k8s-ci-robot k8s-ci-robot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 2, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 2, 2020
@adamzhoul
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind

@adamzhoul
Copy link
Contributor Author

/retest

5 similar comments
@adamzhoul
Copy link
Contributor Author

/retest

@adamzhoul
Copy link
Contributor Author

/retest

@adamzhoul
Copy link
Contributor Author

/retest

@adamzhoul
Copy link
Contributor Author

/retest

@adamzhoul
Copy link
Contributor Author

/retest

@adamzhoul
Copy link
Contributor Author

adamzhoul commented Dec 2, 2020

hi @yliaog a test is added. please take some time to review.

by the way, the "pull-kubernetes-e2e-gce-ubuntu-containerd" check is not successful.
don't know what it is doing, still Investigating...

do you have any thoughts? didn't see any pass recently( almost a day ) by the way.
https://prow.k8s.io/job-history/gs/kubernetes-jenkins/pr-logs/directory/pull-kubernetes-e2e-gce-ubuntu-containerd?buildId=

thanks

Copy link
Contributor

@yliaog yliaog left a comment

Choose a reason for hiding this comment

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

looks pull-kubernetes-e2e-gce-ubuntu-containerd has successful runs lately

@yliaog
Copy link
Contributor

yliaog commented Dec 5, 2020

thanks for the pr
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 5, 2020
@adamzhoul
Copy link
Contributor Author

thanks for the review and suggestions. they are very helpful.

@adamzhoul
Copy link
Contributor Author

/assign @caesarxuchao
please take some time to review. thanks.

@adamzhoul
Copy link
Contributor Author

hi lavalamp.
do you have some time to have a look at this? thanks.

/assign @lavalamp

@lavalamp
Copy link
Member

lavalamp commented Dec 9, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adamzhoul, lavalamp

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2020
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. labels Dec 10, 2020
@adamzhoul
Copy link
Contributor Author

hi @yliaog sorry to trouble you.

I use git rebase to squash commits, which creates a new commit.

maybe I need a new /lgtm label, do you mind?
don't know if another /approve is needed after...

thanks

@yliaog
Copy link
Contributor

yliaog commented Dec 10, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit ccd29ea into kubernetes:master Dec 10, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants