Robust pid locking for shim processes

Closes #2832

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2019-06-21 15:28:16 -04:00
parent bb9616ba20
commit 719a2c594e
5 changed files with 35 additions and 9 deletions

View File

@@ -143,6 +143,9 @@ func (s *createdCheckpointState) Start(ctx context.Context) error {
p := s.p
sio := p.stdio
p.pid.Lock()
defer p.pid.Unlock()
var (
err error
socket *runc.Socket
@@ -182,7 +185,7 @@ func (s *createdCheckpointState) Start(ctx context.Context) error {
if err != nil {
return errors.Wrap(err, "failed to retrieve OCI runtime container pid")
}
p.pid = pid
p.pid.pid = pid
return s.transition("running")
}