Skip to content

Commit 47edb73

Browse files
committed
Merge pull request #727 from mrjana/bugs
Fix race in host sandbox creation
2 parents cd5c267 + 172d095 commit 47edb73

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,14 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (S
507507
return nil, err
508508
}
509509

510+
c.Lock()
510511
if sb.osSbox == nil && !sb.config.useExternalKey {
511512
if sb.osSbox, err = osl.NewSandbox(sb.Key(), !sb.config.useDefaultSandBox); err != nil {
513+
c.Unlock()
512514
return nil, fmt.Errorf("failed to create new osl sandbox: %v", err)
513515
}
514516
}
515517

516-
c.Lock()
517518
c.sandboxes[sb.id] = sb
518519
c.Unlock()
519520
defer func() {

0 commit comments

Comments
 (0)