{"action":"created","issue":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/126","labels_url":"https://api.github.com/repos/svinota/pyroute2/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/svinota/pyroute2/issues/126/comments","events_url":"https://api.github.com/repos/svinota/pyroute2/issues/126/events","html_url":"https://github.com/svinota/pyroute2/issues/126","id":70867906,"number":126,"title":"[Question] calling IPDB() sometimes fails.","user":{"login":"takaomag","id":234209,"avatar_url":"https://avatars.githubusercontent.com/u/234209?v=3","gravatar_id":"","url":"https://api.github.com/users/takaomag","html_url":"https://github.com/takaomag","followers_url":"https://api.github.com/users/takaomag/followers","following_url":"https://api.github.com/users/takaomag/following{/other_user}","gists_url":"https://api.github.com/users/takaomag/gists{/gist_id}","starred_url":"https://api.github.com/users/takaomag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takaomag/subscriptions","organizations_url":"https://api.github.com/users/takaomag/orgs","repos_url":"https://api.github.com/users/takaomag/repos","events_url":"https://api.github.com/users/takaomag/events{/privacy}","received_events_url":"https://api.github.com/users/takaomag/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-25T07:11:39Z","updated_at":"2015-04-25T12:05:35Z","closed_at":null,"body":"Hi,\r\n\r\nI have a quetion about IPDB. I prepared the following test code for simplicity.\r\n\r\n* pyroute version: 0.3.6\r\n\r\n```\r\nfrom pyroute2 import IPDB\r\n\r\ndef get_routes():\r\n    with IPDB() as ipdb:\r\n        routes = ipdb.routes\r\n        result = {\r\n            dst: routes[dst].dump()\r\n            for dst in routes.keys()\r\n        }\r\n\r\nfor i in range(10):\r\n    get_routes()\r\n    print('{}: OK'.format(i))\r\n```\r\n\r\nThere are two environments.\r\n\r\n### On an Archlinux docker container on CoreOS\r\n* kernel version: 3.19.0 (host)\r\n* iproute2 version: iproute2-ss150210 (container)\r\n* python version: 3.4.3 (container)\r\n\r\nLaunch my docker container on CoreOS by\r\n`docker run -it --rm --net host --pid host --privileged -v /run/netns:/run/netns {my_container} /bin/bash`\r\nand call python3 in the container\r\n* result: All passed.\r\n\r\n### On an Archlinux docker container (same image as above) on CentOS 7\r\n* CentOS version: 7.1.1503\r\n* kernel version: 4.0.0-1.el7.elrepo.x86_64 (host)\r\n* iproute2 version: iproute2-ss150210 (same as above because of same image)\r\n* python version: 3.4.3 (same as above because of same image)\r\n\r\nLaunch my docker container on CentOS by\r\n`docker run -it --rm --net host --pid host --privileged -v /run/netns:/run/netns {my_container} /bin/bash`\r\nand call python3 in the container\r\n\r\n* result: OSError [errno 22]\r\n```\r\n0: OK\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 3, in <module>\r\n  File \"<stdin>\", line 2, in get_routes\r\n  File \"/opt/magonet1/lib/python3.4/site-packages/pyroute2/__init__.py\", line 79, in __call__\r\n    return self.proxy['constructor'](*argv, **kwarg)\r\n  File \"/opt/magonet1/lib/python3.4/site-packages/pyroute2/ipdb/__init__.py\", line 404, in __init__\r\n    self.initdb(nl)\r\n  File \"/opt/magonet1/lib/python3.4/site-packages/pyroute2/ipdb/__init__.py\", line 427, in initdb\r\n    self.nl.bind(async=True)\r\n  File \"/opt/magonet1/lib/python3.4/site-packages/pyroute2/netlink/rtnl/__init__.py\", line 233, in bind\r\n    super(IPRSocketMixin, self).bind(groups, async=async)\r\n  File \"/opt/magonet1/lib/python3.4/site-packages/pyroute2/netlink/nlsocket.py\", line 462, in bind\r\n    super(NetlinkMixin, self).bind((self.epid, self.groups))\r\nOSError: [Errno 22] Invalid argument\r\n```\r\n\r\nIt seems an OSError raised after a few (1, 2 or 3) success. This may occur only on my environment. But is there any way or hint to work around it ?\r\n"},"comment":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/comments/96188418","html_url":"https://github.com/svinota/pyroute2/issues/126#issuecomment-96188418","issue_url":"https://api.github.com/repos/svinota/pyroute2/issues/126","id":96188418,"user":{"login":"svinota","id":814602,"avatar_url":"https://avatars.githubusercontent.com/u/814602?v=3","gravatar_id":"","url":"https://api.github.com/users/svinota","html_url":"https://github.com/svinota","followers_url":"https://api.github.com/users/svinota/followers","following_url":"https://api.github.com/users/svinota/following{/other_user}","gists_url":"https://api.github.com/users/svinota/gists{/gist_id}","starred_url":"https://api.github.com/users/svinota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svinota/subscriptions","organizations_url":"https://api.github.com/users/svinota/orgs","repos_url":"https://api.github.com/users/svinota/repos","events_url":"https://api.github.com/users/svinota/events{/privacy}","received_events_url":"https://api.github.com/users/svinota/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T12:05:35Z","updated_at":"2015-04-25T12:05:35Z","body":"Really thanks for the detailed information!\r\n\r\nThe issue definitively needs a fix, started to look into."}}