Public bug reported: When a network is deleted, its segments are also deleted [0]. For each segment, it will notify about resources.SEGMENT and events.AFTER_DELETE [1] which will turn out in calling update_network_postcommit [2].
This should be avoided since drivers expect their postcommit methods to be called with no open sessions to the database. There should be separate callbacks for segments so that there's no transactions opened to the database in any of the postcommit calls. We detected this in networking-ovn driver because we're attempting to bump revision numbers in a separate table in Neutron database when a network is updated but we can't commit that change to the database because there's already an open session on a network delete operation. This may be affecting other drivers as well. [0] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L315 [1] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L178 [2] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/plugins/ml2/plugin.py#L1917 ** Affects: neutron Importance: Undecided Status: New ** Description changed: - When a network is delete, its segments are also deleted [0]. For each + When a network is deleted, its segments are also deleted [0]. For each segment, it will notify about resources.SEGMENT and events.AFTER_DELETE [1] which will turn out in calling update_network_postcommit [2]. This should be avoided since drivers expect their postcommit methods to be called with no open sessions to the database. There should be separate callbacks for segments so that there's no transactions opened to the database in any of the postcommit calls. We detected this in networking-ovn driver because we're attempting to bump revision numbers in Neutron database when a network is updated but we can't commit that change to the database because there's already an open session. This may be affecting other drivers as well. [0] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L315 [1] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L178 [2] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/plugins/ml2/plugin.py#L1917 ** Description changed: When a network is deleted, its segments are also deleted [0]. For each segment, it will notify about resources.SEGMENT and events.AFTER_DELETE [1] which will turn out in calling update_network_postcommit [2]. This should be avoided since drivers expect their postcommit methods to be called with no open sessions to the database. There should be separate callbacks for segments so that there's no transactions opened to the database in any of the postcommit calls. We detected this in networking-ovn driver because we're attempting to - bump revision numbers in Neutron database when a network is updated but - we can't commit that change to the database because there's already an - open session. This may be affecting other drivers as well. + bump revision numbers in a separate table in Neutron database when a + network is updated but we can't commit that change to the database + because there's already an open session on a network delete operation. + This may be affecting other drivers as well. [0] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L315 [1] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L178 [2] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/plugins/ml2/plugin.py#L1917 -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1739798 Title: update_network_postcommit is being called from delete_network_precommit with an open session Status in neutron: New Bug description: When a network is deleted, its segments are also deleted [0]. For each segment, it will notify about resources.SEGMENT and events.AFTER_DELETE [1] which will turn out in calling update_network_postcommit [2]. This should be avoided since drivers expect their postcommit methods to be called with no open sessions to the database. There should be separate callbacks for segments so that there's no transactions opened to the database in any of the postcommit calls. We detected this in networking-ovn driver because we're attempting to bump revision numbers in a separate table in Neutron database when a network is updated but we can't commit that change to the database because there's already an open session on a network delete operation. This may be affecting other drivers as well. [0] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L315 [1] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/services/segments/db.py#L178 [2] https://github.com/openstack/neutron/blob/6cdd079f8f3e6994734fa806b3c819cecb5f521a/neutron/plugins/ml2/plugin.py#L1917 To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1739798/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

