pyroute2
pyroute2 copied to clipboard
NetNS start issue
From the IRC:
< Prokto > @svinota Hi, I'm using pyroute2 to create a basic SDN type of program. I'm very thankful for the library and I'm just trying to figure out what is happening with an issue I'm having. Whenever I create IPDB objects with a NetNS object I eventually run into an issue where my python script just gets stuck and doesn't move. If I interrupt the hanging function with Control+C, I see the same error more or less. The odd thing is I can create more IPDB and < Prokto > NetNS objects without a problem even at this point but if I try to open, for example, IPDB(nl=NetNS('test1')) it just hangs there. I've tried adding a "del ipdb" to my functions that need an IPDB object but I still haven't figure out the source of the problem. I just see the amount of python processes rise until it stops. It seems like gc isn't collecting the old objects but I'm quite honestly a beginner so I'm really not sure what to look for. Sorry < Prokto > for the word-vomit here. < Prokto > Error: https://pastebin.com/SmtN7fL1 < Prokto > Example function: https://pastebin.com/NyH8yTZu < Prokto > and I'm importing "netns" from pyroute2 under another name so that shouldn't be an issue.
Looks like a regression introduced with the recent changes in the Remote
class
An fd leak. If one passes an external RTNL API object to the IPDB constructor, IPDB doesn't close it on release()
. Bad design? Bad docs?
The pastebin no longer exists so I don't know if it is the same problem but I think I am seeing the same hanging behaviour and saw it was stuck on some select.select(inputs, outputs, inputs)
in pyroute2/remote/__init__.py
. I saw that my program had than 1000 file descriptors so it was running into the limit of FD_SETSIZE. Maybe this could be changed to use select.poll
to avoid the fd size limit incase someone already had many files open?