Skip to content

Commit 7fb43fc

Browse files
committed
remove
1 parent 9d0643c commit 7fb43fc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

network/cni/config_linux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cni
33
import (
44
"fmt"
55
"runtime"
6+
"time"
67

78
cns "github.com/containernetworking/plugins/pkg/ns"
89
"github.com/vishvananda/netlink"
@@ -37,7 +38,15 @@ func createNetns(name string) error {
3738
}
3839

3940
// deleteNetns removes a named network namespace.
41+
// Retries briefly because the kernel may still hold a reference to the netns
42+
// right after the CH process is killed (fd cleanup is asynchronous).
4043
func deleteNetns(name string) error {
44+
for range 10 {
45+
if err := netns.DeleteNamed(name); err == nil {
46+
return nil
47+
}
48+
time.Sleep(100 * time.Millisecond)
49+
}
4150
return netns.DeleteNamed(name)
4251
}
4352

0 commit comments

Comments
 (0)