Skip to content

Commit 7d77b51

Browse files
authored
Merge pull request #5569 from tnqn/teardown-network-timeout
Fix cleanup context of teardownPodNetwork
2 parents 68d69b7 + 728743e commit 7d77b51

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/cri/server/sandbox_run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
132132
sandbox.NetNSPath = sandbox.NetNS.GetPath()
133133
defer func() {
134134
if retErr != nil {
135+
deferCtx, deferCancel := ctrdutil.DeferContext()
136+
defer deferCancel()
135137
// Teardown network if an error is returned.
136-
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
138+
if err := c.teardownPodNetwork(deferCtx, sandbox); err != nil {
137139
log.G(ctx).WithError(err).Errorf("Failed to destroy network for sandbox %q", id)
138140
}
139141

0 commit comments

Comments
 (0)