ovn-octvia-provider: RuntimeError: cannot join current thread

Bug #2065459 reported by Terry Wilson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Terry Wilson

Bug Description

The Python garbage collector can run in any thread, and sometimes that thread will be the same thread where shutdown() tries to cal thread.join(). This prevents the rest of the cleanup.

Exception ignored in: <function OvnProviderDriver.__del__ at 0x7f5639307af0>
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/ovn_octavia_provider/driver.py", line 44, in __del__
    self._ovn_helper.shutdown()
  File "/usr/lib/python3.9/site-packages/ovn_octavia_provider/helper.py", line 126, in shutdown
    self.ovn_nbdb.stop()
  File "/usr/lib/python3.9/site-packages/ovn_octavia_provider/ovsdb/impl_idl_ovn.py", line 276, in stop
    if not self.conn.stop(timeout=config.get_ovn_ovsdb_timeout()):
  File "/usr/lib/python3.9/site-packages/ovsdbapp/backend/ovs_idl/connection.py", line 131, in stop
    self.thread.join(timeout)
  File "/usr/lib64/python3.9/threading.py", line 1057, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

Changed in neutron:
status: New → In Progress
Miguel Lavalle (minsel)
Changed in neutron:
importance: Undecided → High
Revision history for this message
Miguel Lavalle (minsel) wrote :
Changed in neutron:
assignee: nobody → Terry Wilson (otherwiseguy)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovn-octavia-provider (master)

Reviewed: https://review.opendev.org/c/openstack/ovn-octavia-provider/+/919229
Committed: https://opendev.org/openstack/ovn-octavia-provider/commit/9c2274e813fe167b79b1ceb7f8da188e251cc6ef
Submitter: "Zuul (22348)"
Branch: master

commit 9c2274e813fe167b79b1ceb7f8da188e251cc6ef
Author: Terry Wilson <email address hidden>
Date: Fri May 10 15:00:05 2024 -0500

    Don't create an OVSDB connection per API request

    Using the default ovsdbapp.backend.ovs_idl.Backend behavior which
    stores the ovsdb_connection on the Backend class itself ensures
    that when Octavia does the imports necessary for instantiating the
    driver, that the ovsdb_connection will remain on the class even
    though the instances are deleted. This will allow us to reuse the
    OVSDB connection between APIs despite octavia-api knowing nothing
    about it.

    In addition, __del__() can called from any thread by the garbage
    collector, and so it was possible that thread.join() would be
    called by the thread we were in, throwing an Exception and
    preventing cleanup.

    Co-authored-by: Gregory Thiemonge <email address hidden>
    Co-authored-by: Ihar Hrachyshka <email address hidden>
    Co-authored-by: Jakub Libosvar <email address hidden>

    Closes-Bug: #2065460
    Closes-Bug: #2065459

    Change-Id: I4f5df34ab32e8b33ff54f311b9b2ac00c9be1e05

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.