-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got Device or resource busy for a new interface #1304
Comments
I just noticed that the "working" version of pyroute2 print this log:
so perhaps that this retry should be reintroduced? |
Investigating, thanks! |
Actually, the reproducer can be simplified with: import os
from pyroute2 import IPRoute
os.system("ip netns add netnsb")
def reproducer():
iprb = IPRoute(netns="netnsb")
ifname = "toto"
iprb.link("add", ifname=ifname, kind="veth", peer="tata", index=2)
reproducer() It looks that forcing index=2 will fail for some unknown reason, but only at the first call, probably not pyroute2 related. The question is then if the "retry" on EBUSY error should be restored on main branch. |
For the record, I found what happens inside the kernel. Each namespace has an XArray to store currents ifindex in use. To find a "free" index, the So:
The second call is working, since internal is now 3, and the peer interface will take ifindex 3. ifindex 2 stay free for our call. We are in a corner case of interface creation, since we are adding a pair of interfaces. |
Hello,
We found a weird issue with recent pyroute2. On master, we ran a code very close of this script:
At first run, response is
pyroute2.netlink.exceptions.NetlinkError: (16, 'Device or resource busy')
when adding the veth.At second run, interface is created.
We reproduced it on several computer (with this script). It looks like setting index is critical here, but I do not understand why. The same code (with adaptation to open iprb is another namespace) was working with a pyroute2 from year 2023.
The text was updated successfully, but these errors were encountered: