vz
vz copied to clipboard
Shared data structure can be accessed concurrently
Describe the bug
shouldAcceptNewConnectionHandlers is a global variable which will be accessed both from NewVirtioSocketListener and shouldAcceptNewConnectionHandler. NewVirtioSocketListener may be called from a different thread/go routine than the one shouldAcceptNewConnectionHandler will run in. We need to protect accesses to shouldAcceptNewConnectionHandlers with a mutex in order to avoid concurrency problems.
Patch from kata-container/vz doing this, rebased on top of master: https://github.com/Code-Hex/vz/compare/master...cfergeau:vz:kata
I will fix them using cgo handler