Skip to contentSkip to conversation

New: ip netns del is asynchronous??? -- very unexpected and puzzling

Bug 215793 Stephen Hemminger 1 participant 1 message Apr 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Begin forwarded message:

Date: Sat, 02 Apr 2022 12:14:36 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 215793] New: ip netns del is asynchronous??? -- very unexpected and puzzling

https://bugzilla.kernel.org/show_bug.cgi?id=215793

            Bug ID: 215793
           Summary: ip netns del is asynchronous??? -- very unexpected and
                    puzzling
           Product: Networking
           Version: 2.5
    Kernel Version: 5.10.106
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Hello,

I have a script like this:

ip netns del test-ns
ip netns add test-ns
ip link add tun-test type gre local any remote 8.8.8.8 ip link set tun-test netns test-ns

As is, the script will fail exactly every other time:

---------------

# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"
# ./nstest.sh 
# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"
# ./nstest.sh 
# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"
# ./nstest.sh 
# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"
# ./nstest.sh 
# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"
# ./nstest.sh 
# ./nstest.sh 
RTNETLINK answers: File exists
Cannot find device "tun-test"

---------------
That's because "ip netns del" seems to return without actually finishing to fully delete the NS. Adding a "sleep 1" after the first line, makes the script complete successfully every time. This is a very unexpected behavior. I would ask for a better workaround than "sleep 1", but I believe there should be no workaround, and the script should reliably work as posted.

Hope you can consider changing this.

Thanks!

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.