mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #20697 from wojtek-t/fix_lock_in_watch_cacher
Fix deadlock in watch cache
This commit is contained in:
		@@ -220,13 +220,13 @@ func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64) ([]interface{
 | 
				
			|||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	w.RLock()
 | 
						w.RLock()
 | 
				
			||||||
 | 
						defer w.RUnlock()
 | 
				
			||||||
	for w.resourceVersion < resourceVersion {
 | 
						for w.resourceVersion < resourceVersion {
 | 
				
			||||||
		if w.clock.Since(startTime) >= MaximumListWait {
 | 
							if w.clock.Since(startTime) >= MaximumListWait {
 | 
				
			||||||
			return nil, 0, fmt.Errorf("time limit exceeded while waiting for resource version %v (current value: %v)", resourceVersion, w.resourceVersion)
 | 
								return nil, 0, fmt.Errorf("time limit exceeded while waiting for resource version %v (current value: %v)", resourceVersion, w.resourceVersion)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		w.cond.Wait()
 | 
							w.cond.Wait()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer w.RUnlock()
 | 
					 | 
				
			||||||
	return w.store.List(), w.resourceVersion, nil
 | 
						return w.store.List(), w.resourceVersion, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user