containerd/metrics
Wei Fu 8a1280b2b6 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: #6772

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-04-10 09:17:21 +08:00
..
cgroups metrics/cgroups: fix deadlock issue in Add during Collect 2022-04-10 09:17:21 +08:00
types Run go fmt with Go 1.17 2021-08-22 09:31:50 +09:00
metrics.go use a const metric for build_info 2021-09-09 12:20:14 -04:00