Deadlock when deleting from ipavailabilityranges

Bug #1332917 reported by Eugene Nikanorov
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Rossella Sblendido
Juno
Fix Released
Undecided
Unassigned

Bug Description

Traceback:
 TRACE neutron.api.v2.resource Traceback (most recent call last):
 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/resource.py", line 87, in resource
 TRACE neutron.api.v2.resource result = method(request=request, **args)
 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 477, in delete
 TRACE neutron.api.v2.resource obj_deleter(request.context, id, **kwargs)
 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/plugin.py", line 608, in delete_subnet
 TRACE neutron.api.v2.resource break
 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 463, in __exit__
 TRACE neutron.api.v2.resource self.rollback()
 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 57, in __exit__
 TRACE neutron.api.v2.resource compat.reraise(exc_type, exc_value, exc_tb)
 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 460, in __exit__
 TRACE neutron.api.v2.resource self.commit()
 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 370, in commit
 TRACE neutron.api.v2.resource self._prepare_impl()
 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 350, in _prepare_impl
 TRACE neutron.api.v2.resource self.session.flush()
 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/openstack/common/db/sqlalchemy/session.py", line 444, in _wrap
 TRACE neutron.api.v2.resource _raise_if_deadlock_error(e, self.bind.dialect.name)
 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/openstack/common/db/sqlalchemy/session.py", line 427, in _raise_if_deadlock_error
 TRACE neutron.api.v2.resource raise exception.DBDeadlock(operational_error)
 TRACE neutron.api.v2.resource DBDeadlock: (OperationalError) (1213, 'Deadlock found when trying to get lock; try restarting transaction') 'DELETE FROM ipavailabilityranges WHERE ipavailabilityranges.allocation_pool_id = %s AND ipavailabilityranges.first_ip = %s AND ipavailabilityranges.last_ip = %s' ('b19b08b6-90f2-43d6-bfe1-9cbe6e0e1d93', '10.100.0.2', '10.100.0.14')

http://logs.openstack.org/21/76021/12/check/check-tempest-dsvm-neutron-full/7577c27/logs/screen-q-svc.txt.gz?level=TRACE#_2014-06-21_18_39_47_122

tags: added: gate-failure
Revision history for this message
Rossella Sblendido (rossella-o) wrote :

I think removing the locking and using a more optimistic strategy (see https://review.openstack.org/#/c/100963/ ) should fix this bug.

Changed in neutron:
assignee: nobody → Rossella Sblendido (rossella-o)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/115360

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
Joe Gordon (jogo) wrote :

no hits in the gate looks like this was somehow resolved

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-3 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/115360
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=532cd91fa79f6061399a1bf326a49c5e6f5ece6b
Submitter: Jenkins
Branch: master

commit 532cd91fa79f6061399a1bf326a49c5e6f5ece6b
Author: rossella <email address hidden>
Date: Tue Aug 19 19:41:16 2014 +0200

    Remove locking from network and subnet delete op

    delete_subnet in Ml2 plugin instead of using SELECT FOR
    UPDATE deletes the IPAllocations that can be auto-deleted
    straight away.
    An exception is raised if there are ports that cannot be
    autodeleted.

    delete_network in ML2 plugin tries to delete all ports
    and subnets before performing the network deletion.
    No lock is needed here - if some other process modifies
    the Port or Subnet table, adding new items, the network
    deletion will fail because of a violation of a foreign
    key contraint.
    In that case the operation will be retried.

    Change-Id: Ib4e9441a95d6c80b92a43d55fdeb18d7b51a1cf3
    Closes-bug: #1332917

Revision history for this message
Matt Fischer (mfisch) wrote :

This was not ever merged to stable/juno. Please remove the Milestone.

Revision history for this message
David Medberry (med) wrote :

Needs backported to stable Juno. juno.3

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/178720

Ethan Lynn (ethanlynn)
tags: added: juno-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/juno)

Reviewed: https://review.openstack.org/178720
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9b182285d9655a16be2d458250d6af94c7e9b074
Submitter: Jenkins
Branch: stable/juno

commit 9b182285d9655a16be2d458250d6af94c7e9b074
Author: Ethan Lynn <email address hidden>
Date: Wed Apr 29 17:19:52 2015 +0800

    Remove locking from network and subnet delete op

    delete_subnet in Ml2 plugin instead of using SELECT FOR
    UPDATE deletes the IPAllocations that can be auto-deleted
    straight away.
    An exception is raised if there are ports that cannot be
    autodeleted.

    delete_network in ML2 plugin tries to delete all ports
    and subnets before performing the network deletion.
    No lock is needed here - if some other process modifies
    the Port or Subnet table, adding new items, the network
    deletion will fail because of a violation of a foreign
    key contraint.
    In that case the operation will be retried.

    Change-Id: Ib4e9441a95d6c80b92a43d55fdeb18d7b51a1cf3
    Closes-bug: #1332917
    (cherry picked from commit 532cd91fa79f6061399a1bf326a49c5e6f5ece6b)

tags: added: in-stable-juno
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.