From 9d3ec58370f5cc6eeb1a5991fcef2a6a00bb57a0 Mon Sep 17 00:00:00 2001 From: "wangyongchao.bj" Date: Fri, 29 Oct 2021 16:21:30 +0800 Subject: [PATCH] runtime: make sure the "Shutdown" trace span have a correct end We only added span.End() in the main process of the shim2 Shutdown method. The "Shutdown" span would keep alive, when the containers number is not 0. This PR make sure the "Shutdown" trace span have a correct end. Fixes: #2930 Signed-off-by: wangyongchao.bj --- src/runtime/pkg/containerd-shim-v2/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/pkg/containerd-shim-v2/service.go b/src/runtime/pkg/containerd-shim-v2/service.go index b17266efac..8bfecef77a 100644 --- a/src/runtime/pkg/containerd-shim-v2/service.go +++ b/src/runtime/pkg/containerd-shim-v2/service.go @@ -935,6 +935,10 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ * s.mu.Lock() if len(s.containers) != 0 { s.mu.Unlock() + + span.End() + katatrace.StopTracing(s.rootCtx) + return empty, nil } s.mu.Unlock()