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

[WIP]fix windows node register failure issue #149

Closed

Conversation

andyzhangx
Copy link
Member

@andyzhangx andyzhangx commented May 24, 2021

What type of PR is this?
/kind bug

What this PR does / why we need it:
fix windows node register failure issue
This PR uses an endless loop to retry registration on Windows only.

On Windows, we found that this node-driver-registrar hang on below statement forever in a little possibility, and then after restart registrar manually, it could register correctly, need a way to add timeout and retry in below statement:

// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)

  • node-driver-registrar hang
I0429 19:12:33.856777    5500 main.go:113] Version: v2.1.0-0-g80d42f24
E0429 19:12:35.055779    5500 processstarttime.go:43] Could not get process start time, could not read /proc: CreateFile /proc: The system cannot find the file specified.
E0429 19:12:35.055779    5500 processstarttime.go:43] Could not get process start time, could not read /proc: CreateFile /proc: The system cannot find the file specified.
I0429 19:12:35.055779    5500 main.go:137] Attempting to open a gRPC connection with: "unix://C:\\\\csi\\\\csi.sock"
I0429 19:12:35.055779    5500 connection.go:153] Connecting to unix://C:\\csi\\csi.sock
I0429 19:12:44.501633    5500 main.go:144] Calling CSI driver to discover driver name
I0429 19:12:44.511914    5500 main.go:154] CSI driver name: "disk.csi.azure.com"
I0429 19:12:44.512939    5500 node_register.go:52] Starting Registration Server at: /registration/disk.csi.azure.com-reg.sock
I0429 19:12:44.523926    5500 node_register.go:61] Registration Server started at: /registration/disk.csi.azure.com-reg.sock
I0429 19:12:44.524941    5500 node_register.go:83] Skipping healthz server because HTTP endpoint is set to: ""
  • After restart driver(run node-driver-registrar), it works
0429 19:12:34.188716    5480 main.go:113] Version: v2.1.0-0-g80d42f24
E0429 19:12:35.839739    5480 processstarttime.go:43] Could not get process start time, could not read /proc: CreateFile /proc: The system cannot find the file specified.
E0429 19:12:35.840735    5480 processstarttime.go:43] Could not get process start time, could not read /proc: CreateFile /proc: The system cannot find the file specified.
I0429 19:12:35.840735    5480 main.go:137] Attempting to open a gRPC connection with: "unix://C:\\\\csi\\\\csi.sock"
I0429 19:12:35.840735    5480 connection.go:153] Connecting to unix://C:\\csi\\csi.sock
I0429 19:12:45.261075    5480 main.go:144] Calling CSI driver to discover driver name
I0429 19:12:45.264589    5480 main.go:154] CSI driver name: "disk.csi.azure.com"
I0429 19:12:45.264589    5480 node_register.go:52] Starting Registration Server at: /registration/disk.csi.azure.com-reg.sock
I0429 19:12:45.266595    5480 node_register.go:61] Registration Server started at: /registration/disk.csi.azure.com-reg.sock
I0429 19:12:45.268093    5480 node_register.go:83] Skipping healthz server because HTTP endpoint is set to: ""
I0429 19:12:45.616080    5480 main.go:80] Received GetInfo call: &InfoRequest{}
I0429 19:12:47.292740    5480 main.go:90] Received NotifyRegistrationStatus call: &RegistrationStatus{PluginRegistered:true,Error:,}

Which issue(s) this PR fixes:

Fixes #143

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix windows node register failure issue

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 24, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: andyzhangx
To complete the pull request process, please assign vladimirvivien after the PR has been reviewed.
You can assign the PR to them by writing /assign @vladimirvivien in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot requested review from msau42 and saad-ali May 24, 2021 09:25
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 24, 2021
@andyzhangx
Copy link
Member Author

andyzhangx commented May 24, 2021

@lizhuqi did you hit this registration issue on GKE Windows node?

Copy link
Collaborator

@msau42 msau42 left a comment

Choose a reason for hiding this comment

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

/assign @jingxu97

// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)
if runtime.GOOS == "windows" {
for true {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of retrying forever, do we want to return fatalf?

Copy link
Member Author

Choose a reason for hiding this comment

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

try a few times(e.g. 10 times) is also an option, I am ok with that.

// try register on Windows node in a loop, detailed issue:
// https://github.com/kubernetes-csi/node-driver-registrar/issues/143
err := wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) {
registerapi.RegisterRegistrationServer(grpcServer, registrar)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The issue description says that this call hangs forever. I don't think this Poll method is going to ever return in that case. I think you'll need to run the call in a go routine and wait for the result or timeout that way.

Copy link
Member Author

@andyzhangx andyzhangx May 26, 2021

Choose a reason for hiding this comment

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

I think that's a wrong fix, do you know is there any way to restart node-driver-registrar automatically if register is not succeeded within a few seconds? The registration issue happens on both Azure & GKE Windows node now. When we hit the issue, restart node driver always works.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think returning a fatal error is the main way to cause node-driver-registrar to restart.

Copy link
Contributor

Choose a reason for hiding this comment

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

From the log you showed that the hang happened after this registration process. So will loop here help?

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR won't work, after registerapi.RegisterRegistrationServer, it just wait for following GetInfo invoked, while sometimes on Windows node, it never happens.

// GetInfo is the RPC invoked by plugin watcher
func (e registrationServer) GetInfo(ctx context.Context, req *registerapi.InfoRequest) (*registerapi.PluginInfo, error) {
klog.Infof("Received GetInfo call: %+v", req)

@lizhuqi
Copy link

lizhuqi commented May 26, 2021

@lizhuqi did you hit this registration issue on GKE Windows node?

I hit this issue on GCE Cluster Windows node.

@andyzhangx andyzhangx changed the title fix windows node register failure issue [WIP]fix windows node register failure issue May 26, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 26, 2021
// Registers kubelet plugin watcher api.
registerapi.RegisterRegistrationServer(grpcServer, registrar)
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure that this is the line where it hangs? I checked the kubelet & gRPC codebase and I see that it's just setting some properties in the server but it's not making any calls:

https://github.com/kubernetes/kubelet/blob/v0.21.1/pkg/apis/pluginregistration/v1/api.pb.go#L213-L215

https://github.com/grpc/grpc-go/blob/0257c8657362b76f24e7a8cfb61df48d4cb735d3/server.go#L625-L661

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

got it, thanks Jing, so it looks like after registration the kubelet doesn't call node-driver-registrar back (which could be because the request never got to the Kubelet or the kubelet acknowledged the request and didn't reply back), I think that if this is reproducible we should check the kubelet logs

Copy link
Member Author

Choose a reason for hiding this comment

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

@mauriciopoppe I am not quite familiar with node-driver-registrar, is there any way to fail when node-driver-registrar did not receive ack from kubelet? There could be many issues that kubelet does not respond, if node-driver-registrar could fail, then it would retry, I think that would fix this issue.

This PR does not fix the issue actully.

Copy link
Member

Choose a reason for hiding this comment

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

I'll add some comments to #143

@andyzhangx
Copy link
Member Author

would be fixed by #152

@andyzhangx andyzhangx closed this Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node driver could not register on Windows in a little possibility
6 participants