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

Upgrade grpc-go dependency and check if file in SocketPath is actually a socket #126

Merged
merged 2 commits into from
Dec 9, 2020

Conversation

Jiawei0227
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:

  1. Return error when registration socket file exists but is not a socket
  2. Upgrade grpc-go dependency to 1.31

Which issue(s) this PR fixes:

Fixes # #104
Fixes # #93

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Return error when file in SocketPath exists but is not a socket; Upgrade grpc-go dependency to 1.31

/assign @chrishenzie
/cc @msau42

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 8, 2020
@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 8, 2020
@k8s-ci-robot k8s-ci-robot requested a review from msau42 December 8, 2020 19:06
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 8, 2020
@msau42
Copy link
Collaborator

msau42 commented Dec 8, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jiawei0227, msau42

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 8, 2020
if isSocket := (fi.Mode()&os.ModeSocket != 0); isSocket {
return true, nil
}
klog.Warningf("file exists in socketPath %s but it's not a socket.: %+v", socketPath, fi)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fix #104? It seems like this will return false and nil for the error if it is not a socket.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good point... I initially return error but then wonder if it will break things so I change it to warning. I think an Error here seems okay to me? It's just we will have to change the CleanUpSocket function as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I vaguely recall the socket checking logic differs between linux and Windows. It might be worth double-checking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is already a TestSocketRegularFile which I modified a little bit that test this behavior.
The limitation is that we will have different behaviors on linux and windows... Because according golang/go#33357, windows socket file are not returning the right mode somehow... So the test will behavior a little bit different based on the two platforms.

@chrishenzie
Copy link
Contributor

Do we have a unit test that asserts we should return an error if the socket path exists but is not a socket file?

@chrishenzie
Copy link
Contributor

/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 9, 2020
@k8s-ci-robot k8s-ci-robot merged commit 511e5c6 into kubernetes-csi:master Dec 9, 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. 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.

4 participants