ip_lib synchronized decorator should wrap the privileged one

Bug #1833721 reported by Rodolfo Alonso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Rodolfo Alonso

Bug Description

In ip_lib library, the methods calling Pyroute commands are decorated with two functions (in this order):
- @privileged.default.entrypoint
- @lockutils.synchronized("privileged-ip-lib")

"synchronized" decorator holds the execution of the function until the lock is released. Using the current decorator ordering, this active wait is done inside the privsep context. This can exhaust the number of execution threads reserved for the privsep daemon.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/666853

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
status: New → In Progress
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Rodolfo Alonso Hernandez (<email address hidden>) on branch: master
Review: https://review.opendev.org/666853
Reason: See PS1 comment.

Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

This patch (https://review.opendev.org/666853) doesn't work in py27. E.g.:

2019-06-22 15:32:20.527787 | ubuntu-bionic | Failed to import test module: neutron.tests.unit.api.rpc.callbacks.test_version_manager
2019-06-22 15:32:20.527861 | ubuntu-bionic | Traceback (most recent call last):
2019-06-22 15:32:20.528090 | ubuntu-bionic | File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 456, in _find_test_path
2019-06-22 15:32:20.528179 | ubuntu-bionic | module = self._get_module_from_name(name)
2019-06-22 15:32:20.528416 | ubuntu-bionic | File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py27/local/lib/python2.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
2019-06-22 15:32:20.528471 | ubuntu-bionic | __import__(name)
2019-06-22 15:32:20.528627 | ubuntu-bionic | File "neutron/tests/unit/api/rpc/callbacks/test_version_manager.py", line 19, in <module>
2019-06-22 15:32:20.528715 | ubuntu-bionic | from neutron.tests import base
2019-06-22 15:32:20.528818 | ubuntu-bionic | File "neutron/tests/base.py", line 48, in <module>
2019-06-22 15:32:20.528917 | ubuntu-bionic | from neutron.agent.linux import external_process
2019-06-22 15:32:20.529039 | ubuntu-bionic | File "neutron/agent/linux/external_process.py", line 27, in <module>
2019-06-22 15:32:20.529124 | ubuntu-bionic | from neutron.agent.linux import ip_lib
2019-06-22 15:32:20.529233 | ubuntu-bionic | File "neutron/agent/linux/ip_lib.py", line 38, in <module>
2019-06-22 15:32:20.529351 | ubuntu-bionic | from neutron.privileged.agent.linux import ip_lib as privileged
2019-06-22 15:32:20.529476 | ubuntu-bionic | File "neutron/privileged/agent/linux/ip_lib.py", line 121, in <module>
2019-06-22 15:32:20.529577 | ubuntu-bionic | def get_routing_table(ip_version, namespace=None):
2019-06-22 15:32:20.529804 | ubuntu-bionic | File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo_concurrency/lockutils.py", line 314, in wrap
2019-06-22 15:32:20.529856 | ubuntu-bionic | @six.wraps(f)
2019-06-22 15:32:20.530055 | ubuntu-bionic | File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py27/local/lib/python2.7/site-packages/six.py", line 811, in wrapper
2019-06-22 15:32:20.530157 | ubuntu-bionic | f = functools.wraps(wrapped, assigned, updated)(f)
2019-06-22 15:32:20.530277 | ubuntu-bionic | File "/usr/lib/python2.7/functools.py", line 33, in update_wrapper
2019-06-22 15:32:20.530372 | ubuntu-bionic | setattr(wrapper, attr, getattr(wrapped, attr))
2019-06-22 15:32:20.530497 | ubuntu-bionic | AttributeError: 'functools.partial' object has no attribute '__module__'

I'll abandon this patch until:
- We abandon py27 (2020).
- We remove the sync decorator (once the Pyroute2 problem is solved); that will mean this bug is not valid anymore.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/683109
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2a7030a6b7ae2ab2e24648727bbde91b05de82cc
Submitter: Zuul
Branch: master

commit 2a7030a6b7ae2ab2e24648727bbde91b05de82cc
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Thu Sep 19 10:58:32 2019 +0000

    Change ip_lib decorators order

    Change the execution order of:
    - @privileged.default.entrypoint
    - @lockutils.synchronized("privileged-ip-lib")

    "synchronized" decorator holds the execution of the function until
    the lock is released. Using the current decorator ordering, this
    active wait is done inside the privsep context. This can exhaust
    the number of execution threads reserved for the privsep daemon.

    Closes-Bug: #1833721

    Change-Id: Ifcce954003e360f620f9131a36a08ab84cbe6193

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/684400

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/stein)

Reviewed: https://review.opendev.org/684400
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=77d4756df8c7b2d6e2721bf14d298c4cfc55585e
Submitter: Zuul
Branch: stable/stein

commit 77d4756df8c7b2d6e2721bf14d298c4cfc55585e
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Thu Sep 19 10:58:32 2019 +0000

    Change ip_lib decorators order

    Change the execution order of:
    - @privileged.default.entrypoint
    - @lockutils.synchronized("privileged-ip-lib")

    "synchronized" decorator holds the execution of the function until
    the lock is released. Using the current decorator ordering, this
    active wait is done inside the privsep context. This can exhaust
    the number of execution threads reserved for the privsep daemon.

    Conflicts:
          neutron/privileged/agent/linux/ip_lib.py

    Closes-Bug: #1833721

    Change-Id: Ifcce954003e360f620f9131a36a08ab84cbe6193
    (cherry picked from commit 2a7030a6b7ae2ab2e24648727bbde91b05de82cc)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 15.0.0.0rc1

This issue was fixed in the openstack/neutron 15.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.3

This issue was fixed in the openstack/neutron 14.0.3 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.