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

Fix deadlock in recursive metric locks #581

Merged
merged 1 commit into from
Aug 19, 2021

Conversation

jsafrane
Copy link
Contributor

What type of PR is this?
/kind bug
/kind flake

What this PR does / why we need it:
RecordMetrics() grabs a mutex and calls recordCancelMetric(), which wants to grab the same mutex. Go mutexes are not recursive, so recordCancelMetric blocks forever.

recordCancelMetric should not grab the mutex, all its callers already have the mutex.

Which issue(s) this PR fixes:
Fixes #580

Does this PR introduce a user-facing change?:

Fixed deadlock in reporting metrics.

RecordMetrics() grabs a mutex and calls recordCancelMetric(), which wants to
grab the same mutex. Go mutexes are not recursive, so recordCancelMetric
blocks forever.

recordCancelMetric should not grab the mutex, it can be sure that the
caller did it already.
@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. kind/flake Categorizes issue or PR as related to a flaky test. labels Aug 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane

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 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. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 19, 2021
@xing-yang
Copy link
Collaborator

/assign @ggriffiths

@jsafrane
Copy link
Contributor Author

/test pull-kubernetes-csi-external-snapshotter-1-21-on-kubernetes-1-21

@ggriffiths
Copy link
Member

/lgtm

If this does not get rid of the deadlocks, feel free to revert my original PR and I can take a closer look after my PTO.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2021
@k8s-ci-robot k8s-ci-robot merged commit c4a2ac7 into kubernetes-csi:master Aug 19, 2021
@xing-yang
Copy link
Collaborator

Looks like the pull-kubernetes-csi-external-snapshotter-1-21-on-kubernetes-1-21 job is not blocking the merge. The job is still pending.

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. kind/flake Categorizes issue or PR as related to a flaky test. 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4.2.0 snapshot-controller stops working after a while
4 participants