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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/1.6] metrics/cgroups: fix deadlock issue in Add during Collect #6801

Merged
merged 1 commit into from Apr 11, 2022

Commits on Apr 11, 2022

  1. metrics/cgroups: fix deadlock issue in Add during Collect

    The Collector.Collect will be the field ns'Collect's callback, which be
    invoked periodically with internal lock. And Collector.Add also runs
    with ns.Lock in Collector.Lock, which is easy to cause deadlock.
    
    Goroutine X:
    
    	ns.Collect
    	  ns.Lock
    	    Collector.Collect
    	      Collector.RLock
    
    Goroutine Y:
    
    	Collector.Add
    	  Collector.Lock
    	    ns.Lock
    
    We should use ns.Lock without Collector.Lock in Add.
    
    Fix: containerd#6772
    
    Signed-off-by: Wei Fu <fuweid89@gmail.com>
    (cherry picked from commit 8a1280b)
    Signed-off-by: Wei Fu <fuweid89@gmail.com>
    fuweid committed Apr 11, 2022
    Copy the full SHA
    fe6ba62 View commit details
    Browse the repository at this point in the history