Skip to content
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

Allow to pass the libc when opening a namespace context #702

Closed
ralonsoh opened this issue Apr 22, 2020 · 5 comments
Closed

Allow to pass the libc when opening a namespace context #702

ralonsoh opened this issue Apr 22, 2020 · 5 comments

Comments

@ralonsoh
Copy link
Contributor

"netns.nslink.NetNS" calls "netns.setns". "setns" method allows to set explicitly the libc to be used. For example, instead of using CDLL, PyDLL could be used. This could help, when using eventlet, to make calls without releasing the GIL.

References:

ralonsoh added a commit to ralonsoh/pyroute2 that referenced this issue Apr 22, 2020
When a NetNS context is created, the method "netns.setns" is called
to set the namespace to be used. This method can use a shared
library explicitly defined in the input arguments; e.g.: ctypes.PyDLL
instead of ctypes.CDLL.

This will help if eventlet is used. PyDLL for example [1], behaves
like CDLL except that the Python GIL is not released during the
function call.

[1]https://docs.python.org/3.6/library/ctypes.html#ctypes.PyDLL

Bug-Url: svinota#702
svinota added a commit that referenced this issue Apr 22, 2020
@svinota
Copy link
Owner

svinota commented Apr 22, 2020

Reasonable, fixed.

Do you need a release to be tagged asap, or it can wait?

@ralonsoh
Copy link
Contributor Author

Hi Peter:

No, there is no rush. We'll wait for a new release and then we'll bump the min version required in Neutron.

Regards!

@ralonsoh
Copy link
Contributor Author

ralonsoh commented Apr 23, 2020

Sorry but in [1] you should pass the libc variable to setns. This should be:
setns(self.netns, self.flags, libc=libc)
[1]628381f#diff-dcc31244f805780321e3b09d4772a480R152

@svinota
Copy link
Owner

svinota commented Apr 23, 2020

Ough, my bad. Thanks a lot.

ralonsoh added a commit to ralonsoh/pyroute2 that referenced this issue May 5, 2020
svinota added a commit that referenced this issue May 6, 2020
@ralonsoh
Copy link
Contributor Author

Thanks a lot!

openstack-mirroring pushed a commit to openstack/requirements that referenced this issue Jul 28, 2020
This version contains a patch needed in Neutron:
- svinota/pyroute2#702

Change-Id: I2f3f5a613d63058a9f940099ec2c3ea8d74dfb10
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Jul 28, 2020
* Update requirements from branch 'master'
  - Merge "Bump pyroute2 upper version to 0.5.13"
  - Bump pyroute2 upper version to 0.5.13
    
    This version contains a patch needed in Neutron:
    - svinota/pyroute2#702
    
    Change-Id: I2f3f5a613d63058a9f940099ec2c3ea8d74dfb10
bmwiedemann added a commit to bmwiedemann/openSUSE that referenced this issue Aug 5, 2020
https://build.opensuse.org/request/show/824351
by user dirkmueller + dimstar_suse
- update to 0.5.13:
  * netns: allow to pass custom libc reference <svinota/pyroute2#702>
  * generic: att L2TP support <svinota/pyroute2#709>
  * iproute: link_lookup() optimization <svinota/pyroute2#712>
  * ndb: basic cluster support
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Aug 7, 2020
* Update neutron from branch 'master'
  - Merge "Specify C shared library in Pyroute2 namespace context"
  - Specify C shared library in Pyroute2 namespace context
    
    Since [1], it's possible to specify the shared library to be used
    when creating a Pyroute2 namespace context.
    
    As commented in [2], "privsep" library makes use of eventlet to
    implement multitasking. If the method executed returns the GIL,
    nothing guarantees that the "eventlet" executor will return it
    again to this task. This could lead to timeouts during the
    execution of those methods.
    
    From https://docs.python.org/3.6/library/ctypes.html#ctypes.PyDLL:
      "Instances of this class behave like CDLL instances, except that
       the Python GIL is not released during the function call, and
       after the function execution the Python error flag is checked."
    
    [1]svinota/pyroute2#702
    [2]https://review.opendev.org/#/c/717017/
    
    Change-Id: I6c9f9adba8b4433cc96704bb69dd4e0d4b154ebd
    Related-Bug: #1870352
openstack-mirroring pushed a commit to openstack/neutron that referenced this issue Aug 7, 2020
Since [1], it's possible to specify the shared library to be used
when creating a Pyroute2 namespace context.

As commented in [2], "privsep" library makes use of eventlet to
implement multitasking. If the method executed returns the GIL,
nothing guarantees that the "eventlet" executor will return it
again to this task. This could lead to timeouts during the
execution of those methods.

From https://docs.python.org/3.6/library/ctypes.html#ctypes.PyDLL:
  "Instances of this class behave like CDLL instances, except that
   the Python GIL is not released during the function call, and
   after the function execution the Python error flag is checked."

[1]svinota/pyroute2#702
[2]https://review.opendev.org/#/c/717017/

Change-Id: I6c9f9adba8b4433cc96704bb69dd4e0d4b154ebd
Related-Bug: #1870352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants