Unverified Commit fca65dcd authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #62464 from choury/fix-double-rlock-in-cpumanger

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. avoid dobule RLock() in cpumanager **What this PR does / why we need it**: We met a deadlock when removing pod. kubelet keeps logging: ``` Pod "xxxx" is terminated, but some containers are still running ``` After debug, we found it stuck in `SetDefaultCPUSet` [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cm/cpumanager/policy_static.go#L184) while another goroutine are calling `GetCPUSetOrDefault` [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cm/cpumanager/cpu_manager.go#L256). According golang/go#15418, It is not safe to double RLock a RWMutex. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: none **Special notes for your reviewer**: **Release note**: ```release-note removed unsafe double RLock in cpumanager ```
parents 316b76f0 c1b19fce
...@@ -56,9 +56,6 @@ func (s *stateMemory) GetDefaultCPUSet() cpuset.CPUSet { ...@@ -56,9 +56,6 @@ func (s *stateMemory) GetDefaultCPUSet() cpuset.CPUSet {
} }
func (s *stateMemory) GetCPUSetOrDefault(containerID string) cpuset.CPUSet { func (s *stateMemory) GetCPUSetOrDefault(containerID string) cpuset.CPUSet {
s.RLock()
defer s.RUnlock()
if res, ok := s.GetCPUSet(containerID); ok { if res, ok := s.GetCPUSet(containerID); ok {
return res return res
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment