Pyroute2 netns.ns_pids() will fail if during the function loop, one namespace is deleted

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

Bug Description

Log: https://2af908e1173c237cb5bf-b484a2b89d5d2c358f068133dfb2fa14.ssl.cf2.rackcdn.com/678905/1/check/neutron-functional/9770e53/testr_results.html.gz

If during the namepace PIDs retrieval one of those namespaces is deleted, the method [1] will fail with the exception:
  FileNotFoundError: [Errno 2] No such file or directory

[1] https://github.com/svinota/pyroute2/blob/b25a6ca6c91da45cb5b54e7caffa1644fed2330d/pyroute2/netns/__init__.py#L163

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Submitted an issue in Pyroute2: https://github.com/svinota/pyroute2/issues/633

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

Related fix proposed to branch: master
Review: https://review.opendev.org/679026

tags: added: pyroute2
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/679026
Reason: This workaround now can trigger a timeout exception... [1]

I'll try a better solution, implementing inside Neutron the method to read the namespace PIDs.

[1] https://storage.gra1.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/logs_26/679026/4/gate/neutron-functional-python27/27c64b1/testr_results.html.gz

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

Related fix proposed to branch: master
Review: https://review.opendev.org/679428

Changed in neutron:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.opendev.org/679428
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=085e9d8b3de44a6edd71f2de7e9c2acde053b331
Submitter: Zuul
Branch: master

commit 085e9d8b3de44a6edd71f2de7e9c2acde053b331
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Aug 30 12:09:45 2019 +0000

    Implement "list_ns_pids" inside Neutron

    Instead of using Pyroute2.netns.ns_pids() [1], while [2] is not
    solved, a method to list a namespace PIDs is implemented in this
    patch.

    This implementation is based on the Pyroute2 method.

    [1]https://github.com/svinota/pyroute2/blob/80f6e7fcdd4136933a7f164ba2cee25f134dc85c/pyroute2/netns/__init__.py#L163
    [2]https://github.com/svinota/pyroute2/issues/633

    Change-Id: Ic00c02035a0dabf1a1efd1995c84692649c6ad27
    Related-Bug: #1841753

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

Related fix proposed to branch: master
Review: https://review.opendev.org/692396

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

Reviewed: https://review.opendev.org/692396
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9ad03dcf96b9b2fbe43dede8b59c99542bda237a
Submitter: Zuul
Branch: master

commit 9ad03dcf96b9b2fbe43dede8b59c99542bda237a
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Thu Oct 31 15:32:09 2019 +0000

    Catch FileNotFoundError when listing namespace PIDs

    During the namespace PID listing, if a process is stopped, it will
    disappear from "/proc/<pid>". When "os.stat(path)" is executed on
    an unexistent path, returns "FileNotFoundError". This exception
    should be catched and ignored.

    Change-Id: Icde5e15bd97578f5ec8273f22ef8384502be1850
    Related-Bug: #1841753

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/718227

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

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

commit bf05b63f1b102b3bedde1c637d272982d8d4813a
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Aug 30 12:09:45 2019 +0000

    Implement "list_ns_pids" inside Neutron

    Instead of using Pyroute2.netns.ns_pids() [1], while [2] is not
    solved, a method to list a namespace PIDs is implemented in this
    patch.

    This implementation is based on the Pyroute2 method.

    [1]https://github.com/svinota/pyroute2/blob/80f6e7fcdd4136933a7f164ba2cee25f134dc85c/pyroute2/netns/__init__.py#L163
    [2]https://github.com/svinota/pyroute2/issues/633

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

    Change-Id: Ic00c02035a0dabf1a1efd1995c84692649c6ad27
    Related-Bug: #1841753
    (cherry picked from commit 085e9d8b3de44a6edd71f2de7e9c2acde053b331)

tags: added: in-stable-stein
Changed in neutron:
status: In Progress → Fix Released
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.