Skip to content

fix: stop ticker/timer in waitForMount to avoid leak#2465

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
dimbleby:fix/wait-for-mount-ticker-leak
May 18, 2026
Merged

fix: stop ticker/timer in waitForMount to avoid leak#2465
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
dimbleby:fix/wait-for-mount-ticker-leak

Conversation

@dimbleby
Copy link
Copy Markdown
Contributor

@dimbleby dimbleby commented May 16, 2026

What type of PR is this?
/kind bug

What this PR does / why we need it:

waitForMount used time.Tick and time.After. time.Tick's underlying ticker is never garbage collected per the Go documentation, so every blobfuse mount leaked a runtime ticker that kept firing after the function returned. On the timeout path the ticker would continue to tick forever.

Use time.NewTicker and time.NewTimer with deferred Stop so resources are released when the function returns.

Which issue(s) this PR fixes:

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 16, 2026
@k8s-ci-robot k8s-ci-robot requested review from andyzhangx and cvvz May 16, 2026 18:15
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 16, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: dimbleby / name: David Hotham (dfc6c3a)

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @dimbleby!

It looks like this is your first PR to kubernetes-sigs/blob-csi-driver 🎉. 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/blob-csi-driver 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
Copy Markdown
Contributor

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

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. 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 May 16, 2026
@dimbleby dimbleby force-pushed the fix/wait-for-mount-ticker-leak branch from 26c620a to 2225263 Compare May 16, 2026 18:17
waitForMount used time.Tick and time.After. time.Tick's underlying
ticker is never garbage collected per the Go documentation, so every
blobfuse mount leaked a runtime ticker that kept firing after the
function returned. On the timeout path the ticker would continue to
tick forever.

Use time.NewTicker and time.NewTimer with deferred Stop so resources
are released when the function returns.
@dimbleby dimbleby force-pushed the fix/wait-for-mount-ticker-leak branch from 2225263 to dfc6c3a Compare May 16, 2026 18:19
@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 May 16, 2026
@andyzhangx andyzhangx requested a review from Copilot May 17, 2026 01:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a runtime resource leak in waitForMount by replacing time.Tick/time.After (which prevent the underlying ticker/timer from being garbage-collected) with time.NewTicker/time.NewTimer paired with deferred Stop() calls.

Changes:

  • Replace time.Tick(intervel) with time.NewTicker + defer ticker.Stop().
  • Replace time.After(timeout) with time.NewTimer + defer timer.Stop().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andyzhangx
Copy link
Copy Markdown
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 May 17, 2026
@andyzhangx andyzhangx requested a review from Copilot May 17, 2026 07:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, dimbleby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 May 18, 2026
@k8s-ci-robot k8s-ci-robot merged commit 4742685 into kubernetes-sigs:master May 18, 2026
30 checks passed
@andyzhangx
Copy link
Copy Markdown
Member

/cherrypick release-1.27

@k8s-infra-cherrypick-robot
Copy link
Copy Markdown

@andyzhangx: new pull request created: #2471

Details

In response to this:

/cherrypick release-1.27

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-sigs/prow 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. 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. 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.

5 participants