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

fixes a bug that connection refused error cannot be recognized correctly #81634

Merged
merged 1 commit into from Aug 23, 2019

Conversation

@likakuli
Copy link
Contributor

commented Aug 20, 2019

What type of PR is this?

/kind bug

What this PR does / why we need it:
When listerWatcher returns a "connection refused" error, the opError.Err's type is os.SyscallError and its Error() is "connect: connection refused". So the code

time.sleep(1 * time.second) 
continue

will not be excuted forever. Thus

return nil

will be excuted and the func will return.

Which issue(s) this PR fixes:

Fixes #
When there is a "connection refused" error, the reflector's ListAndWatch func will return directly but what expected is that sleep 1 second and rewatch since the specified resourceVersion.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fixes a bug that when there is a "connection refused" error, the reflector's ListAndWatch func will return directly but what expected is that sleep 1 second and rewatch since the specified resourceVersion.

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


@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2019

Hi @likakuli. 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.

@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 20, 2019

/assign @lavalamp
thank you

@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 20, 2019

/assign @yliaog
This is the new pr and i have closed the old pr, thank you

@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 20, 2019

/assign @liggitt
thank you

@liggitt

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

suggested an alternative way to improve how robust this method is to changes in the network library. you can force push test/implementation changes to this branch without needing to open a new PR

@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 20, 2019

suggested an alternative way to improve how robust this method is to changes in the network library. you can force push test/implementation changes to this branch without needing to open a new PR

OK, thank you for your suggestion. I will try it now

@likakuli likakuli force-pushed the likakuli:fix_errno branch from dc2e862 to b45c940 Aug 20, 2019
@liggitt

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

/ok-to-test

@likakuli likakuli force-pushed the likakuli:fix_errno branch from b45c940 to 3cec909 Aug 20, 2019
@liggitt

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

/lgtm
/approve
/ok-to-test

@k8s-ci-robot k8s-ci-robot added the lgtm label Aug 20, 2019
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, likakuli

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

@yliaog

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2019

/lgtm

@dims

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from dims Aug 20, 2019
@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2019

/uncc @mfojtik

@k8s-ci-robot k8s-ci-robot removed the request for review from mfojtik Aug 21, 2019
@likakuli

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2019

/retest

if urlErr, ok := err.(*url.Error); ok {
err = urlErr.Err
}
if opErr, ok := err.(*net.OpError); ok {

This comment has been minimized.

Copy link
@tedyu

tedyu Aug 22, 2019

Contributor

If ok is false for any if statement, we can return, right ?

This comment has been minimized.

Copy link
@asalkeld

asalkeld Aug 22, 2019

Contributor

no, you could get a net.OpError that is not wrapped by url.Error etc..

@@ -54,3 +54,20 @@ func IsConnectionReset(err error) bool {
}
return false
}

// Returns if the given err is "connection refused" error
func IsConnectionRefused(err error) bool {

This comment has been minimized.

Copy link
@asalkeld

asalkeld Aug 22, 2019

Contributor

Here is another way of doing it: https://github.com/openshift/openshift-azure/blob/master/pkg/util/errors/errors.go
(not saying you have to do it that way... just fyi)

This comment has been minimized.

Copy link
@likakuli

likakuli Aug 22, 2019

Author Contributor

copy that, thx

@k8s-ci-robot k8s-ci-robot merged commit 22a8bcf into kubernetes:master Aug 23, 2019
23 checks passed
23 checks passed
cla/linuxfoundation likakuli authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.