[eventlet-removal] Remove the usage of eventlet in the L3 agent

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

Bug Description

References:
* https://etherpad.opendev.org/p/oct2024-ptg-neutron
* https://etherpad.opendev.org/p/neutron-eventlet-deprecation

Remove the import and usage of the eventlet library in the L3 agent.

============================================================

It is spawned using ``oslo_service.launch``. Same comment as in the OVN Neutron agent.

It uses a greenpool to handle the resource processing https://github.com/openstack/neutron/blob/04e9efec78fe308b50f6f1eab8b24f29f3164684/neutron/agent/l3/agent.py#L331. Same as in the DHCP agent (https://review.opendev.org/c/openstack/neutron/+/923626), it is questionable the speed improvement of this implementation.

It also uses ``eventlet.spawn`` in HA to spawn the keepalived notifications server.

tags: added: eventlet-deprecation
Changed in neutron:
status: New → Confirmed
importance: Undecided → Wishlist
Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
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/c/openstack/neutron/+/938404

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/938406

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/938411

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/938541

summary: - [eventlet-deprecation] Remove the usage of eventlet in the L3 agent
+ [eventlet-removal] Remove the usage of eventlet in the L3 agent
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by "Rodolfo Alonso <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/938406

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/938541
Committed: https://opendev.org/openstack/neutron/commit/a0e2b939a91275c86c0698d9780546ce1461cf6d
Submitter: "Zuul (22348)"
Branch: master

commit a0e2b939a91275c86c0698d9780546ce1461cf6d
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Jan 7 09:28:59 2025 +0000

    [eventlet-removal] Replace ``eventlet.spawn_n`` usage

    This patch replaces the usage of ``eventlet.spawn_n`` in the L3 HA
    agent module. The method ``_enqueue_state_change`` is now executed
    within a ``threading.Thread``.

    Partial-Bug: #2087943
    Change-Id: I0b876d25bec5f2bbd580ac88d21b712a8eaf8e81

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/c/openstack/neutron/+/946992

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/946992
Committed: https://opendev.org/openstack/neutron/commit/6699134f3e722958fcf91eb8051317a358b6841a
Submitter: "Zuul (22348)"
Branch: master

commit 6699134f3e722958fcf91eb8051317a358b6841a
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Apr 11 10:22:08 2025 +0000

    [L3] Remove the thread pool resizable mechanism

    This patch removes the thread pool resizable mechanism for the L3 agent,
    implemented in [1]. The rationale for this change is:
    * This mechanism doesn't actually improve the resources consumption on
      a busy system. If the number of requests is high, the size of the pool
      will be the highest number (32).
    * The pool only will spawn as many threads as concurrent requests are
      received.
    * The hardcoded number of maximum threads for the pool is set to 32,
      the maximum number.
    * The resizable mechanism is not implemented in any other thread pool
      class outside eventlet.

    [1]https://review.opendev.org/c/openstack/neutron/+/633869

    Partial-Bug: #2087943
    Change-Id: I3e8da21d441710b5fea4b5d88e39657f4b69b695

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.opendev.org/c/openstack/neutron/+/945566
Committed: https://opendev.org/openstack/neutron/commit/8d8ce2741401f8a91942bf81e7811b298e759cf2
Submitter: "Zuul (22348)"
Branch: master

commit 8d8ce2741401f8a91942bf81e7811b298e759cf2
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Mar 25 20:49:26 2025 +0000

    Add the utility class ``ThreadPoolExecutorWithBlock``

    This class inherits from ``futures.ThreadPoolExecutor`` and provides
    a blocking submit method that only returns when the work queue is
    empty; that means, it is only possible to add a new task only if no
    other tasks are waiting. This behaviour replicates the
    ``eventlet.GreenPool.submit`` method and is expected to replace it.

    Partial-Bug: #2087943
    Change-Id: I77c258cdcf3cff6ae5fdc733269c2276737971b0

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.opendev.org/c/openstack/neutron/+/938411
Committed: https://opendev.org/openstack/neutron/commit/d6baf954f38563743afa008269d4bad7c2a1103e
Submitter: "Zuul (22348)"
Branch: master

commit d6baf954f38563743afa008269d4bad7c2a1103e
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Mar 25 21:28:44 2025 +0000

    [eventlet-removal] Replace ``eventlet.GreenPool`` in the L3 agent

    This patch replaces the usage of ``eventlet.GreenPool`` in the L3
    agent code with ``ThreadPoolExecutorWithBlock``.

    Partial-Bug: #2087943
    Change-Id: I4b12d8038c845d5327691b1005788e14525fbbca

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/c/openstack/neutron/+/949135

tags: added: eventlet-removal
removed: eventlet-deprecation
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/949135
Committed: https://opendev.org/openstack/neutron/commit/99bd0c9331c901e9f1633b58f2e52a8a7aef69d3
Submitter: "Zuul (22348)"
Branch: master

commit 99bd0c9331c901e9f1633b58f2e52a8a7aef69d3
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Thu May 8 09:05:48 2025 +0000

    Move the RPC initialization to the ``Service.start`` phase

    The RPC L3 agent clients and servers should be instantiated and
    initalizated during the ``Service`` start phase, not during the
    class initalization. The L3 agent main class is handled by the
    ``oslo_service.Service`` class as the manager class. When the
    process (L3 agent) is started, the service class forks the process
    during the ``service.launch`` call [1]. That could lead to issues
    with the created RPC client/servers before the fork [2].

    This patch moves all the RPC instantiation and initialization to
    the ``Service.start`` method, that first calls the manager
    ``init_host`` method.

    This patch must work both with the current ``oslo.service`` backend
    (eventlet) and the future implementation (threading) [3].

    [1]https://github.com/openstack/neutron/blob/a2af9b8baafe3c9926841b8cffed4c4644c2936d/neutron/agent/l3_agent.py#L61
    [2]https://github.com/openstack/oslo.messaging/blob/510688d8ddc807242fe9a36532dd03ba3c2d4ad5/oslo_messaging/_drivers/impl_rabbit.py#L1081-L1086
    [3]https://review.opendev.org/c/openstack/oslo.service/+/945720

    Partial-Bug: #2087943
    Change-Id: Ic8561f5b971a04b95c381daa05a071582ab4b3b5

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/c/openstack/neutron/+/952220

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/938404
Committed: https://opendev.org/openstack/neutron/commit/5292b13bbdd4e00dadbbef72400b737aab3dd0ff
Submitter: "Zuul (22348)"
Branch: master

commit 5292b13bbdd4e00dadbbef72400b737aab3dd0ff
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Jan 3 14:58:41 2025 +0000

    [eventlet-removal] Remove the usage of eventlet in the L3 agent

    This patch removes the usage of eventlet in the L3 agent. It removes
    the last bits using this library and changes the implementation of the
    WSGI server.

    This patch replaces the WSGI ``neutron-keepalived-state-change``
    server with an implementation based on
    ``socketserver.ThreadingUnixStreamServer``. The
    ``KeepalivedStateChangeHandler`` class is now inheriting from
    ``socketserver.StreamRequestHandler``. This change is
    similar to the changes done for the Metadata agents before [1][2]

    This patch bumps the ``oslo.service`` library to 4.2.0, that includes
    [3]. Note that the requirements line is also requesting the dependencies
    for "threading", that install aditional libraries.

    [1]https://review.opendev.org/c/openstack/neutron/+/938393
    [2]https://review.opendev.org/c/openstack/neutron/+/942916
    [3]https://review.opendev.org/c/openstack/oslo.service/+/945720

    Closes-Bug: #2087943
    Change-Id: I82f7b4e4c4f165bab114a0ab5ee4948d3ee8ce63

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/952220
Committed: https://opendev.org/openstack/neutron/commit/c6373755221e77bb7b3684b23f8a63e01d1aebe7
Submitter: "Zuul (22348)"
Branch: master

commit c6373755221e77bb7b3684b23f8a63e01d1aebe7
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Jun 10 11:08:00 2025 +0000

    [eventlet-removal] Patch unit tests for keepalived not. server

    Related-Bug: #2087943
    Change-Id: I66aab28aa44a49eb6077c9a89a10f27fadb1c394

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

This issue was fixed in the openstack/neutron 27.0.0.0b1 Flamingo development milestone.

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.