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 <wangyongchao.bj@inspur.com>
This commit is contained in:
wangyongchao.bj 2021-10-29 16:21:30 +08:00
parent 71b69c36d5
commit 9d3ec58370

View File

@ -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()