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

🐛 Don't call session logout for keepAliveHandler #1949

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

xiujuanx
Copy link
Contributor

@xiujuanx xiujuanx commented Jun 19, 2023

What this PR does / why we need it:
We should not call session logout when keepAliveHandler. Once we call Logout, it means we send a stop signal to the handler. So when we reboot the VC, the keepAliveHandler finds the vCenter is down and we call logout, the keepAliveHandler will stop work. Also at this time, the VC is down, so logout will be stuck.
So this PR remove the session logout logic for keepAliveHandler, and keep session logout when the session is inactive.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1925

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

None

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 19, 2023
@k8s-ci-robot k8s-ci-robot requested a review from srm09 June 19, 2023 03:15
@k8s-ci-robot
Copy link
Contributor

Welcome @xiujuanx!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-vsphere 🎉. 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-sigs/cluster-api-provider-vsphere 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
Copy link
Contributor

Hi @xiujuanx. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 19, 2023
@tommasopozzetti
Copy link

@srm09 Any chance of getting this reviewed and merged/released?
This issue is continuing to bite us and at the moment requires constant monitoring and manual restarting of the controller. This change would be extremely valuable to automate the safe-healing!
Thank you!

@xiujuanx xiujuanx changed the title Don't call session logout for keepAliveHandler bug: Don't call session logout for keepAliveHandler Jun 27, 2023
@xiujuanx xiujuanx changed the title bug: Don't call session logout for keepAliveHandler 🐛 Don't call session logout for keepAliveHandler Jun 27, 2023
}
if _, ok := sessionCache.Load(sessionKey); ok {
logger.Info("clearing the session", "key", sessionKey)
sessionCache.Delete(sessionKey)
Copy link
Contributor

@zhanggbj zhanggbj Jun 28, 2023

Choose a reason for hiding this comment

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

Hi @xiujuanx , since sessionCache.Delete() is actually contains func (m *Map) LoadAndDelete(key any) (value any, loaded bool) which will load&delete in an atomic way, so do we still need the check sessionCache.Load(sessionKey) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @zhanggbj for your review!
Indeed, we should not check if the key exists in the cache or not twice. I have changed the code, please help review it again. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

@xiujuanx xiujuanx force-pushed the fix-vc-reboot branch 2 times, most recently from 3ea2a0b to e519592 Compare June 29, 2023 04:00
@xiujuanx xiujuanx requested a review from zhanggbj June 29, 2023 04:00
@zhanggbj
Copy link
Contributor

/lgtm Thanks for the PR!

And need approvers to take a review @srm09 @MaxRink @yastij

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 30, 2023
@chrischdi
Copy link
Member

/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 Jul 5, 2023
@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 Jul 6, 2023
@xiujuanx
Copy link
Contributor Author

xiujuanx commented Jul 6, 2023

/ok-to-test

@xiujuanx
Copy link
Contributor Author

xiujuanx commented Jul 6, 2023

/test pull-cluster-api-provider-vsphere-verify-gen

1 similar comment
@xiujuanx
Copy link
Contributor Author

xiujuanx commented Jul 6, 2023

/test pull-cluster-api-provider-vsphere-verify-gen

@zhanggbj
Copy link
Contributor

zhanggbj commented Jul 6, 2023

@xiujuanx there's a known issue for verify-gen, if this is the same case, you can ignore it #1928

@xiujuanx
Copy link
Contributor Author

xiujuanx commented Jul 6, 2023

Thanks @zhanggbj ! I run make generate locally doesn't generate any difference.

@sbueringer
Copy link
Member

/retest-required

@chrischdi
Copy link
Member

/test pull-cluster-api-provider-vsphere-verify-gen

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 14, 2023
@sbueringer
Copy link
Member

Thanks @zhanggbj ! I run make generate locally doesn't generate any difference.

I think the issue should be fixed now, can you rebase?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 17, 2023
@xiujuanx
Copy link
Contributor Author

Thanks @sbueringer for your kind reminder! I have rebased the code, so pls help review again, thanks!

@xiujuanx
Copy link
Contributor Author

/test pull-cluster-api-provider-vsphere-e2e

1 similar comment
@chrischdi
Copy link
Member

/test pull-cluster-api-provider-vsphere-e2e

@srm09
Copy link
Contributor

srm09 commented Jul 17, 2023

/lgtm
/retest

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 17, 2023
@randomvariable
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: randomvariable

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 Jul 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit 1868fc1 into kubernetes-sigs:main Jul 18, 2023
4 checks passed
@sbueringer
Copy link
Member

Let's cherry-pick this one as well

/cherry-pick release-1.7

@sbueringer
Copy link
Member

/cherry-pick release-1.6

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #2027

In response to this:

Let's cherry-pick this one as well

/cherry-pick release-1.7

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-infra-cherrypick-robot

@sbueringer: #1949 failed to apply on top of branch "release-1.6":

Applying: don't call session logout for keephandler
Using index info to reconstruct a base tree...
M	pkg/session/session.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/session/session.go
CONFLICT (content): Merge conflict in pkg/session/session.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 don't call session logout for keephandler
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.6

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-infra-cherrypick-robot

@sbueringer: #1949 failed to apply on top of branch "release-1.5":

Applying: don't call session logout for keephandler
Using index info to reconstruct a base tree...
M	pkg/session/session.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/session/session.go
CONFLICT (content): Merge conflict in pkg/session/session.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 don't call session logout for keephandler
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.5

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.

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete machine will be stuck in deleting status after the vCenter is reboot
9 participants