container: protect health monitor channel
container: protect health monitor channel

While this code was likely called from a single thread before, we have
now seen panics, indicating that it could be called in parallel. This
change adds a mutex to protect opening and closing of the channel. There
may be another root cause associated with this panic, such as something
that led to the calling of this in parallel, as this code is old and we
had seen this condition until recently.

This fix is by no means a permanent fix. Typically, bugs like this
indicate misplaced channel ownership. In idiomatic uses, the channel
should have a particular "owner" that coordinates sending and closure.
In this case, the owner of the channel is unclear, so it gets opened
lazily. Synchronizing this access is a decent solution, but a refactor
may yield better results.

Signed-off-by: Stephen J Day <63efd86fa22882ae89b6027b22a36e4db1f4214d@docker.com>

mixja/docker,tonistiigi/docker,pradipd/moby,jimjag/docker,PatrickLang/moby,johnstep/moby-moby,PatrickLang/moby,dims/docker,duglin/docker,jwhonce/docker,tophj-ibm/docker,shishir-a412ed/docker,noironetworks/docker,dims/docker,jameszhan/docker,bearstech/moby,unclejack/docker,thaJeztah/docker,moby/moby,jlhawn/docker,srust/docker,tophj-ibm/moby,jimjag/docker,yongtang/docker,laijs/moby,docker/docker,rancher/docker,crosbymichael/docker,konstruktoid/docker-upstream,paralin/docker,moul/docker,crosbymichael/docker,rancher/docker,unclejack/docker,trebonian/docker,docker/docker,KarthikNayak/docker,laijs/moby,AkihiroSuda/docker,nalind/docker,kojiromike/docker,nawawi/docker,justincormack/docker,mahak/docker,ripcurld0/moby,ibuildthecloud/docker,whuwxl/docker,estesp/docker,estesp/docker,paralin/docker,YuPengZTE/docker,laijs/docker,ibuildthecloud/docker,rhatdan/docker,mikebrow/docker,jlhawn/docker,jimjag/docker,dmcgowan/docker,Mokolea/docker,moul/docker,KingEmet/docker,kojiromike/docker,noironetworks/docker,tmp6154/docker,Ramzec/docker,allencloud/docker,Ramzec/docker,maxamillion/docker,flavio/docker,cpuguy83/docker,srust/docker,AkihiroSuda/docker,trebonian/docker,pradipd/moby,rhatdan/docker,johnstep/moby-moby,KarthikNayak/docker,Mokolea/docker,jwhonce/docker,ibuildthecloud/docker,konstruktoid/docker-upstream,dccurtis/docker,konstruktoid/docker-1,justincormack/docker,allencloud/docker,moby/moby,laijs/docker,whuwxl/docker,SvenDowideit/docker,rancher/docker,jvanz/docker,trebonian/docker,gnailuy/docker,duglin/docker,bearstech/moby,jwhonce/docker,cpuguy83/docker,estesp/docker,tophj-ibm/docker,noironetworks/docker,mixja/docker,ndeloof/docker,yosifkit/docker,konstruktoid/docker-1,yosifkit/docker,Mokolea/docker,gnailuy/docker,laijs/docker,KingEmet/docker,nawawi/docker,dccurtis/docker,SvenDowideit/docker,jameszhan/docker,ripcurld0/moby,shishir-a412ed/docker,AkihiroSuda/docker,tonistiigi/docker,yummypeng/docker,yummypeng/docker,bearstech/moby,moby/moby,dmcgowan/docker,vdemeester/docker,duglin/docker,x1022as/docker,mahak/docker,KingEmet/docker,ndeloof/docker,srust/docker,konstruktoid/docker-upstream,yummypeng/docker,konstruktoid/docker-1,kolyshkin/moby,mikebrow/docker,tophj-ibm/moby,yongtang/docker,moul/docker,kolyshkin/moby,unclejack/docker,jvanz/docker,flavio/docker,laijs/moby,scotttlin/docker,KarthikNayak/docker,SvenDowideit/docker,bearstech/moby,Ramzec/docker,justincormack/docker,djs55/docker,scotttlin/docker,kolyshkin/moby,kolyshkin/docker,djs55/docker,thaJeztah/docker,YuPengZTE/docker,thaJeztah/docker,flavio/docker,x1022as/docker,yongtang/docker,whuwxl/docker,dmcgowan/docker,Mokolea/docker,shishir-a412ed/docker,nalind/docker,docker/docker,thaJeztah/docker,paralin/docker,jthelin/docker,nalind/docker,Ramzec/docker,maxamillion/docker,PatrickLang/moby,maxamillion/docker,ndeloof/docker,mahak/docker,crosbymichael/docker,tophj-ibm/moby,gnailuy/docker,ripcurld0/moby,trebonian/docker,tonistiigi/docker,jimjag/docker,tmp6154/docker,moul/docker,AkihiroSuda/docker,djs55/docker,mahak/docker,mikebrow/docker,dims/docker,flavio/docker,ibuildthecloud/docker,jlhawn/docker,mixja/docker,YuPengZTE/docker,jameszhan/docker,yosifkit/docker,yosifkit/docker,jvanz/docker,tophj-ibm/docker,pradipd/moby,dccurtis/docker,tmp6154/docker,rremer/moby,nawawi/docker,vdemeester/docker,rhatdan/docker,jthelin/docker,paralin/docker,kolyshkin/docker,gnailuy/docker,ibuildthecloud/docker,allencloud/docker,konstruktoid/docker-upstream,cpuguy83/docker,johnstep/moby-moby,rremer/moby,cpuguy83/docker,x1022as/docker,rremer/moby,moby/moby,kojiromike/docker,nalind/docker,nawawi/docker,vdemeester/docker,scotttlin/docker