Close Open disk file handles#126
Conversation
|
Hi @wongma7. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/ok-to-test |
|
@wongma7 could you address the comment? |
|
/lgtm |
|
/assign @msau42 please approve! 2 liner PR! many thanks! |
|
|
||
| for i := range disks { | ||
| h, err := syscall.Open(disks[i].Path, syscall.O_RDONLY, 0) | ||
| defer syscall.Close(h) |
There was a problem hiding this comment.
What's the maximum number of disks a node can have? Would it be worth enclosing this loop in a code section so that it gets closed at the end of each loop?
There was a problem hiding this comment.
for ec2 depends on instance type but typically like 20-30
https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/volume_limits.html#instance-type-volume-limits (EKS only supports windows nitro instances so the "AWS PV" driver in the other section don't apply)
do you mean to wrap it like this? I don't think it's worth the loss in readability
func() (uint32, error) {
...
syscall.Open
defer syscall.Close(h)
}()
There was a problem hiding this comment.
There was a problem hiding this comment.
did some refactoring so we always open and close 1 handle at a time
|
New changes are detected. LGTM label has been removed. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wongma7 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/hold need to retest on my setup |
|
@wongma7 thanks for this PR. Pls let me know after you test it. |
|
/hold cancel together with #145 I tested that attach, mount, unmount, detach works with ebs |
|
|
||
| var ErrNotFound = errors.New("not found") | ||
|
|
||
| func (imp APIImplementor) getDiskNumberByID(path string, page83ID string) (uint32, error) { |
There was a problem hiding this comment.
I am kind of confused by these two functions getDiskNumberAndIDByPath and getDiskNumberByID.
Is there a way to kind of combine those?
There was a problem hiding this comment.
okay, let me combine.
(the PR started as 2 lines, bit by bit it has ballooned, so I am getting confused too 😂)
|
@mauriciopoppe is working on disk API part #140 |
|
@jingxu97 I'm going to revert to the original PR where I just call syscall.Close(h) at end of the loop. I don't want to refactor and then rebase if beta3 API will make it obsolete |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If csi-proxy keeps these files open it blocks EBS detach from succeeding.
I tested this fix and it works for me.
Full story:
While debugging my EBS CSI implementation I found everything worked fine except for volume Detach. EBS support said OS was reporting something holding on to the disk (despite me trying removing all accesspoints, taking disk offline, etc.). Eventually after much guessing and testing, narrowed it to csi-proxy, i.e. as soon as I stopped it Detach would proceed. (I'm no Windows expert so possibly there was an easier way to find out what was holding onto device, like via process explorer, but yeah...)
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: