From b13cdefb722703b2c72e2c5fd8e9c7028bc9fb04 Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Tue, 27 Apr 2021 20:37:06 +0800 Subject: [PATCH] fix: avoid host worker is locked when image cache is deleted --- pkg/hostman/storageman/imagecache_local.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/hostman/storageman/imagecache_local.go b/pkg/hostman/storageman/imagecache_local.go index 378592f9a2..56b8a9e2a6 100644 --- a/pkg/hostman/storageman/imagecache_local.go +++ b/pkg/hostman/storageman/imagecache_local.go @@ -205,6 +205,10 @@ func (l *SLocalImageCache) fetch(ctx context.Context, zone, srcUrl, format strin defer l.cond.L.Unlock() l.Desc = l.remoteFile.GetInfo() + if l.Desc == nil { + l.remoteFile = nil + return false + } l.Size = l.GetSize() / 1024 / 1024 l.Desc.Id = l.imageId l.remoteFile = nil