Comment 2 for bug 2027755

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/888513
Committed: https://opendev.org/openstack/nova/commit/9ae6240c92e212b2fa96d5163f68ef1b30ee03b7
Submitter: "Zuul (22348)"
Branch: master

commit 9ae6240c92e212b2fa96d5163f68ef1b30ee03b7
Author: melanie witt <email address hidden>
Date: Fri Jul 14 02:23:23 2023 +0000

    Decorate only Flavor.get_* methods that execute queries

    The get_* methods on the Flavor object use a common helper method to
    build a query object to execute later.

    Currently, the @api_db_api.context_manager.reader decorator which
    manages the session is located on the helper method instead of on the
    methods that actually execute the database queries. Part of the context
    manager's job is to close the session after the query is executed.
    Because the decorator is not on the methods that actually execute the
    queries, those database connections are not being closed and it will
    eventually lead to errors like:

      sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 50
      reached, connection timed out, timeout 30.00 (Background on this
      error at: https://sqlalche.me/e/14/3o7r)

    which means the connection pool size plus the overflow size has been
    reached and the pool will block for a fixed period of time before
    timing out and raising this error.

    This removes the @api_db_api.context_manager.reader decorator from the
    query build helper method and adds it to the Flavor.get_* methods that
    execute the database queries.

    Closes-Bug: #2027755

    Change-Id: I4bf83d1642b62ab103716aff6dae7438646e2b31