Fix a race in pkg/discovery/memory
Fix a race in pkg/discovery/memory

Fix #22964

Signed-off-by: Akihiro Suda <ea940da7e429af3d0d0c18296cabd0112a36bad5@lab.ntt.co.jp>

paralin/docker,YuPengZTE/docker,ffoysal/docker,pradipd/moby,thtanaka/docker,denverdino/docker.github.io,mohmost12/docker,konstruktoid/docker-1,londoncalling/docker.github.io,trebonian/docker,mtrmac/docker,ndeloof/docker,joaofnfernandes/docker.github.io,estesp/docker,akira-baruah/docker,moypray/docker,michael-holzheu/docker,KarthikNayak/docker,rhatdan/storage,denverdino/denverdino.github.io,bdwill/docker.github.io,endophage/docker,jwhonce/docker,jthelin/docker,gjaskiewicz/moby,stainboy/docker,Ramzec/docker,ripcurld0/moby,laijs/moby,prertik/docker,Shopify/docker,kerneltime/docker,tmp6154/docker,kolyshkin/docker,scotttlin/docker,sfsmithcha/docker,jameszhan/docker,yongtang/docker,rancher/docker,sarnautov/moby,qudongfang/docker,fcrisciani/docker,tophj-ibm/moby,13W/docker,moul/docker,charleswhchan/docker,joeuo/docker.github.io,whuwxl/docker,willmtemple/docker,coreos/docker,tophj-ibm/docker,denverdino/docker.github.io,tmp6154/docker,docker-zh/docker.github.io,phiroict/docker,coreos/docker,joeuo/docker.github.io,cpuguy83/docker,xiekeyang/docker,willmtemple/docker,gschaetz/moby,joeuo/docker.github.io,mtesselH/docker,jzwlqx/denverdino.github.io,pradipd/moby,harche/docker,jhorwit2/docker,docker/docker.github.io,bluebreezecf/docker,jameszhan/docker,dccurtis/docker,dsau/docker,toli/docker,13W/docker,madhanrm/docker,phiroict/docker,dperny/docker,bdwill/docker.github.io,jhorwit2/docker,jlebon/docker,lixiaobing1/docker,icaoweiwei/docker,yongtang/docker,shhsu/docker,gschaetz/moby,bonczj/moby-json-file-logger,coolljt0725/docker,rancher/docker,containers/storage,dgageot/docker,cyphar/docker,pecameron/docker,LuisBosquez/docker.github.io,flavio/docker,johnstep/docker.github.io,maxamillion/docker,AkihiroSuda/docker,ajaymdesai/docker,tianon/docker,ColinHebert/docker,noxiouz/docker,sanscontext/docker.github.io,yosifkit/docker,ibuildthecloud/docker,mike1729/docker,SvenDowideit/docker,menglingwei/denverdino.github.io,shin-/docker.github.io,darrenstahlmsft/moby,tophj-ibm/docker,charleswhchan/docker,catinthesky/docker,asbjornenge/docker,nghiant2710/docker,jthelin/docker,portworx/docker,HideoYamauchi/docker,rhatdan/storage,danyalKhaliq10p/moby,tkopczynski/docker,liaoqingwei/docker,Shopify/docker,eskaaren/docker,Tenk42/docker,xiekeyang/docker,justyntemme/docker,bearstech/moby,moby/moby,liaoqingwei/docker,jimjag/docker,allencloud/docker,jimjag/docker,imkin/moby,mkumatag/docker,HuKeping/docker,dongjoon-hyun/docker,jimjag/docker,alexisbellido/docker.github.io,nawawi/docker,dsheets/moby,konstruktoid/docker-1,haveatry/docker,bonczj/moby-json-file-logger,laijs/docker,moul/docker,jzwlqx/denverdino.github.io,medallia/docker,splunk/docker,shin-/docker.github.io,londoncalling/docker.github.io,denverdino/docker.github.io,tophj-ibm/moby,jwhonce/docker,mkumatag/docker,imkin/moby,dgageot/docker,nawawi/docker,noironetworks/docker,Ramzec/docker,gdevillele/docker.github.io,xiaods/docker,KingEmet/docker,alfred-landrum/docker,haveatry/docker,mikebrow/docker,projectatomic/docker,JimGalasyn/docker.github.io,johnstep/docker.github.io,cyphar/docker,ibuildthecloud/docker,gjaskiewicz/moby,brahmaroutu/docker,harche/docker,portworx/docker,srust/docker,hqhq/moby,charleszheng44/moby,mgoelzer/docker,gigidwan/docker,kunalkushwaha/docker,pramodhkp/moby,shhsu/docker,dims/docker,mahak/docker,lixiaobing10051267/docker,sdurrheimer/docker,rillig/docker.github.io,jlhawn/docker,LuisBosquez/docker.github.io,nalind/docker,kunalkushwaha/docker,HideoYamauchi/docker,jongiddy/docker,xiaods/docker,jlhawn/docker,michelvocks/docker,konstruktoid/docker-upstream,tophj-ibm/moby,docker/docker.github.io,resin-io/docker,qudongfang/docker,raja-sami-10p/moby,dccurtis/docker,yosifkit/docker,duglin/docker,cpuguy83/docker,mtanlee/docker,tophj-ibm/docker,13W/docker,wenchma/docker,imkin/moby,vdemeester/docker,mtanlee/docker,alexisbellido/docker.github.io,londoncalling/docker.github.io,troy0820/docker.github.io,docker-zh/docker.github.io,madhanrm/docker,aduermael/docker.github.io,yp-engineering/docker,pramodhkp/moby,q384566678/docker,justincormack/docker,JimGalasyn/docker.github.io,ibuildthecloud/docker,anweiss/docker.github.io,ndeloof/docker,ffoysal/docker,charleswhchan/docker,kojiromike/docker,SvenDowideit/docker,laijs/docker,docker/docker,bdwill/docker.github.io,toli/docker,Syntaxide/docker,msabansal/docker,jongiddy/docker,hqhq/moby,naveed-jamil-tenpearls/moby,willmtemple/docker,dsau/docker,vdemeester/docker,kolyshkin/moby,kolyshkin/docker,LuisBosquez/docker.github.io,rremer/moby,docker/docker.github.io,jvanz/docker,aduermael/docker.github.io,sanscontext/docker.github.io,noxiouz/docker,scotttlin/docker,kunalkushwaha/docker,rremer/moby,yongtang/docker,yasiramin10p/moby,trebonian/docker,YuPengZTE/docker,tagomoris/docker,johnstep/moby-moby,trebonian/docker,akira-baruah/docker,miminar/docker,mikedougherty/docker,fcrisciani/docker,cr7pt0gr4ph7/docker,unclejack/docker,darrenstahlmsft/docker,justyntemme/docker,yosifkit/docker,dccurtis/docker,thaJeztah/docker,mixja/docker,jvanz/docker,KarthikNayak/docker,shubheksha/docker.github.io,bearstech/moby,michael-holzheu/docker,mixja/docker,abhinavdahiya/docker,LuisBosquez/docker.github.io,erikstmartin/docker,thaJeztah/docker,BSWANG/denverdino.github.io,mahak/docker,cpuguy83/docker,containers/storage,projectatomic/docker,amatsus/docker,noironetworks/docker,BSWANG/denverdino.github.io,ripcurld0/moby,yummypeng/docker,Tenk42/docker,estesp/docker,sfsmithcha/docker,PatrickLang/moby,gnailuy/docker,shubheksha/docker.github.io,danix800/docker.github.io,crosbymichael/docker,naveed-jamil-tenpearls/moby,ajaymdesai/docker,justincormack/docker,lixiaobing10051267/docker,dims/docker,xuxinkun/docker,thtanaka/docker,Mokolea/docker,danix800/docker.github.io,afein/docker,stevvooe/docker,gdevillele/docker.github.io,sanjeo/docker,joaofnfernandes/docker.github.io,yp-engineering/docker,dnephin/docker,Ramzec/docker,dongjoon-hyun/docker,cloudflare/docker,ripcurld0/moby,catinthesky/docker,hypriot/docker,tklauser/docker,harche/docker,x1022as/docker,fcrisciani/docker,Morsicus/docker,SvenDowideit/docker,wenchma/docker,thaJeztah/docker.github.io,darrenstahlmsft/moby,erikstmartin/docker,gigidwan/docker,justincormack/docker,docker/docker.github.io,dmcgowan/docker,yp-engineering/docker,kencochrane/docker,kolyshkin/moby,phiroict/docker,trebonian/docker,PatrickLang/moby,bonczj/moby-json-file-logger,denverdino/denverdino.github.io,troy0820/docker.github.io,twaugh/docker,shishir-a412ed/docker,denverdino/docker.github.io,nalind/docker,ibuildthecloud/docker,menglingwei/denverdino.github.io,Syntaxide/docker,aduermael/docker.github.io,nghiant2710/docker,docker/docker,JMesser81/docker,YuPengZTE/docker,pramodhkp/moby,cyphar/docker,mkumatag/docker,rillig/docker.github.io,asbjornenge/docker,sanscontext/docker.github.io,gnailuy/docker,darrenstahlmsft/docker,thaJeztah/docker.github.io,q384566678/docker,anweiss/docker.github.io,thaJeztah/docker,gnailuy/docker,bearstech/moby,x1022as/docker,mstanleyjones/docker,xuxinkun/docker,ajaymdesai/docker,paralin/docker,afein/docker,miminar/docker,rillig/docker.github.io,erikstmartin/docker,mtanlee/docker,toli/docker,HuKeping/docker,moul/docker,shin-/docker.github.io,ColinHebert/docker,jlebon/docker,flavio/docker,abhinavdahiya/docker,bdwill/docker.github.io,danyalKhaliq10p/moby,menglingwei/denverdino.github.io,yummypeng/docker,q384566678/docker,mikedougherty/docker,jameszhan/docker,joeuo/docker.github.io,dongjoon-hyun/docker,denverdino/denverdino.github.io,mohmost12/docker,bearstech/moby,JimGalasyn/docker.github.io,thaJeztah/docker,lixiaobing1/docker,yasiramin10p/moby,danix800/docker.github.io,nawawi/docker,yummypeng/docker,cr7pt0gr4ph7/docker,tkopczynski/docker,erikh/docker,gnailuy/docker,zhuguihua/docker,allencloud/docker,asbjornenge/docker,tklauser/docker,AkihiroSuda/docker,shin-/docker.github.io,amatsus/docker,kolyshkin/moby,msabansal/docker,tagomoris/docker,konstruktoid/docker-upstream,nalind/docker,sarnautov/moby,konstruktoid/docker-upstream,KingEmet/docker,johnstep/moby-moby,maxamillion/docker,rhatdan/docker,diogomonica/docker,zhuguihua/docker,resin-io/docker,abhinavdahiya/docker,pradipd/moby,michelvocks/docker,mgoelzer/docker,thaJeztah/docker.github.io,scotttlin/docker,KingEmet/docker,nawawi/docker,resin-io/docker,dsheets/moby,denverdino/denverdino.github.io,BSWANG/denverdino.github.io,diogomonica/docker,kojiromike/docker,eskaaren/docker,sdurrheimer/docker,moby/moby,rillig/docker.github.io,mahak/docker,vdemeester/docker,docker-zh/docker.github.io,mtrmac/docker,johnstep/docker.github.io,catinthesky/docker,tonistiigi/docker,gdevillele/docker.github.io,miminar/docker,moypray/docker,qudongfang/docker,anweiss/docker.github.io,Syntaxide/docker,Mokolea/docker,gdevillele/docker.github.io,cr7pt0gr4ph7/docker,docker/docker.github.io,rhatdan/docker,michelvocks/docker,rancher/docker,PatrickLang/moby,sfsmithcha/docker,gschaetz/moby,johnstep/docker.github.io,erikh/docker,menglingwei/denverdino.github.io,coreos/docker,medallia/docker,dnephin/docker,jhorwit2/docker,jlebon/docker,portworx/docker,endophage/docker,hypriot/docker,Morsicus/docker,AkihiroSuda/docker,konstruktoid/docker-upstream,unclejack/docker,alexisbellido/docker.github.io,noxiouz/docker,ndeloof/docker,denverdino/denverdino.github.io,justyntemme/docker,londoncalling/docker.github.io,yasiramin10p/moby,laijs/docker,stainboy/docker,Mokolea/docker,jwhonce/docker,xiaods/docker,brahmaroutu/docker,duglin/docker,cloudflare/docker,naveed-jamil-tenpearls/moby,docker/docker,shin-/docker.github.io,dmcgowan/docker,projectatomic/docker,gdevillele/docker.github.io,troy0820/docker.github.io,shishir-a412ed/docker,aduermael/docker.github.io,jimjag/docker,anweiss/docker.github.io,icaoweiwei/docker,amatsus/docker,flavio/docker,haveatry/docker,menglingwei/denverdino.github.io,mtesselH/docker,whuwxl/docker,medallia/docker,dsheets/moby,rremer/moby,allencloud/docker,kencochrane/docker,michael-holzheu/docker,jlhawn/docker,joeuo/docker.github.io,shubheksha/docker.github.io,dims/docker,tonistiigi/docker,docker-zh/docker.github.io,stevvooe/docker,yosifkit/docker,containers/storage,denverdino/docker.github.io,JMesser81/docker,mahak/docker,sterchelen/docker,darrenstahlmsft/docker,lixiaobing10051267/docker,mtesselH/docker,cpuguy83/docker,tklauser/docker,darrenstahlmsft/moby,johnstep/docker.github.io,thaJeztah/docker.github.io,KarthikNayak/docker,medallia/docker,erikh/docker,charleszheng44/moby,sanscontext/docker.github.io,danix800/docker.github.io,tagomoris/docker,brahmaroutu/docker,dnephin/docker,sterchelen/docker,xuxinkun/docker,mikebrow/docker,sanjeo/docker,paralin/docker,crosbymichael/docker,nalind/docker,pecameron/docker,unclejack/docker,moul/docker,estesp/docker,ffoysal/docker,phiroict/docker,gjaskiewicz/moby,wenchma/docker,splunk/docker,JimGalasyn/docker.github.io,diogomonica/docker,bluebreezecf/docker,twaugh/docker,rhatdan/storage,dperny/docker,londoncalling/docker.github.io,Morsicus/docker,moby/moby,eskaaren/docker,icaoweiwei/docker,Mokolea/docker,hqhq/moby,duglin/docker,Shopify/docker,endophage/docker,alfred-landrum/docker,anweiss/docker.github.io,Tenk42/docker,cloudflare/docker,shubheksha/docker.github.io,noironetworks/docker,kencochrane/docker,alfred-landrum/docker,raja-sami-10p/moby,13W/docker,HideoYamauchi/docker,thtanaka/docker,phiroict/docker,jongiddy/docker,joaofnfernandes/docker.github.io,dmcgowan/docker,BSWANG/denverdino.github.io,sterchelen/docker,msabansal/docker,hypriot/docker,prertik/docker,troy0820/docker.github.io,dsau/docker,14rcole/docker,mike1729/docker,docker-zh/docker.github.io,thaJeztah/docker.github.io,crosbymichael/docker,maxamillion/docker,13W/docker,x1022as/docker,14rcole/docker,zhuguihua/docker,danyalKhaliq10p/moby,alexisbellido/docker.github.io,mstanleyjones/docker,POLJM242/docker,prertik/docker,alexisbellido/docker.github.io,konstruktoid/docker-1,twaugh/docker,sanscontext/docker.github.io,lixiaobing1/docker,whuwxl/docker,mikedougherty/docker,kojiromike/docker,nghiant2710/docker,madhanrm/docker,ColinHebert/docker,jzwlqx/denverdino.github.io,bdwill/docker.github.io,Ramzec/docker,sanjeo/docker,splunk/docker,mikebrow/docker,djs55/docker,mixja/docker,sarnautov/moby,JMesser81/docker,djs55/docker,jvanz/docker,coolljt0725/docker,jzwlqx/denverdino.github.io,dgageot/docker,srust/docker,djs55/docker,pecameron/docker,tianon/docker,rhatdan/docker,tkopczynski/docker,shubheksha/docker.github.io,LuisBosquez/docker.github.io,tmp6154/docker,gigidwan/docker,stainboy/docker,sdurrheimer/docker,raja-sami-10p/moby,JimGalasyn/docker.github.io,moby/moby,dperny/docker,mstanleyjones/docker,mgoelzer/docker,kerneltime/docker,xiekeyang/docker,mike1729/docker,mtrmac/docker,stevvooe/docker,HuKeping/docker,tonistiigi/docker,AkihiroSuda/docker,liaoqingwei/docker,paralin/docker,shishir-a412ed/docker,charleszheng44/moby,kerneltime/docker,joaofnfernandes/docker.github.io,laijs/moby,johnstep/moby-moby,ibuildthecloud/docker,srust/docker,afein/docker,joaofnfernandes/docker.github.io,shhsu/docker,laijs/moby,jzwlqx/denverdino.github.io,flavio/docker,mohmost12/docker,bluebreezecf/docker,POLJM242/docker,coolljt0725/docker,BSWANG/denverdino.github.io,moypray/docker