Integrity violation on delete network

Bug #1235486 reported by Salvatore Orlando
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Armando Migliaccio
Havana
Fix Released
High
Armando Migliaccio

Bug Description

Found while running tests for bug 1224001.
Full logs here: http://logs.openstack.org/24/49424/13/check/check-tempest-devstack-vm-neutron-pg-isolated/405d3b4

Keeping to medium priority for now.
Will raise priority if we found more occurrences.

2013-10-04 21:20:46.888 31438 ERROR neutron.api.v2.resource [-] delete failed
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource Traceback (most recent call last):
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/resource.py", line 84, in resource
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource result = method(request=request, **args)
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 432, in delete
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource obj_deleter(request.context, id, **kwargs)
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/plugin.py", line 411, in delete_network
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource break
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 456, in __exit__
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource self.commit()
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 368, in commit
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource self._prepare_impl()
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 347, in _prepare_impl
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource self.session.flush()
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/openstack/common/db/sqlalchemy/session.py", line 542, in _wrap
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource raise exception.DBError(e)
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource DBError: (IntegrityError) update or delete on table "networks" violates foreign key constraint "ports_network_id_fkey" on table "ports"
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource DETAIL: Key (id)=(c63057f4-8d8e-497c-95d6-0d93d2cc83f5) is still referenced from table "ports".
2013-10-04 21:20:46.888 31438 TRACE neutron.api.v2.resource 'DELETE FROM networks WHERE networks.id = %(id)s' {'id': u'c63057f4-8d8e-497c-95d6-0d93d2cc83f5'}

Tags: db
Revision history for this message
Joe Gordon (jogo) wrote :

query: @message:"update or delete on table \"networks\" violates foreign key constraint \"ports_network_id_fkey\" on table \"ports\"" AND @fields.filename:"logs/screen-q-svc.txt"

found 10 hits in last 24 hours using logstash.openstack.org

Changed in neutron:
status: New → Confirmed
Revision history for this message
Henry Gessau (gessau) wrote :

This might be fixed by https://review.openstack.org/49644 (line 395).

Changed in neutron:
assignee: nobody → Robert Kukura (rkukura)
status: Confirmed → In Progress
Revision history for this message
Sean Dague (sdague) wrote :

This is confirmed to still be an issue, just saw it fail again.

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

Reviewed: https://review.openstack.org/49644
Committed: http://github.com/openstack/neutron/commit/ed78b563e13f1ed9189d7c4b9cd4317f2a50e734
Submitter: Jenkins
Branch: master

commit ed78b563e13f1ed9189d7c4b9cd4317f2a50e734
Author: Bob Kukura <email address hidden>
Date: Thu Oct 3 12:25:24 2013 -0400

    Fix auto-deletion of ports when deleting subnets in ML2

    When a subnet is deleted, certain ports referencing it are
    auto-deleted. The implementation of NeutronDBPluginV2.delete_subnet()
    does this at the DB level, so ML2's mechanism drivers were not being
    called.

    Ml2Plugin.delete_subnet() is changed to not use the base class's
    method, and to auto-delete ports by calling its own delete_port()
    method outside of the transaction. A loop avoids race conditions with
    ports being asynchronously added to the subnet.

    The logic in Ml2Plugin.delete_network() is also fixed to properly
    handle auto-deleting ports and subnets, and debug logging is added to
    the various delete methods.

    Closes-Bug: 1234195
    Partial-Bug: 1235486
    Change-Id: I6d74f89d39ea8afe6915f1d2f9afdf66c0076f5a

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

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/51303

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

Reviewed: https://review.openstack.org/51303
Committed: http://github.com/openstack/neutron/commit/bfe1dca0563cd5beadf91e3688924c44f5063778
Submitter: Jenkins
Branch: milestone-proposed

commit bfe1dca0563cd5beadf91e3688924c44f5063778
Author: Bob Kukura <email address hidden>
Date: Thu Oct 3 12:25:24 2013 -0400

    Fix auto-deletion of ports when deleting subnets in ML2

    When a subnet is deleted, certain ports referencing it are
    auto-deleted. The implementation of NeutronDBPluginV2.delete_subnet()
    does this at the DB level, so ML2's mechanism drivers were not being
    called.

    Ml2Plugin.delete_subnet() is changed to not use the base class's
    method, and to auto-delete ports by calling its own delete_port()
    method outside of the transaction. A loop avoids race conditions with
    ports being asynchronously added to the subnet.

    The logic in Ml2Plugin.delete_network() is also fixed to properly
    handle auto-deleting ports and subnets, and debug logging is added to
    the various delete methods.

    Closes-Bug: 1234195
    Partial-Bug: 1235486
    Change-Id: I6d74f89d39ea8afe6915f1d2f9afdf66c0076f5a
    (cherry picked from commit ed78b563e13f1ed9189d7c4b9cd4317f2a50e734)

Revision history for this message
Anita Kuno (anteaya) wrote :
Changed in neutron:
importance: Medium → High
Revision history for this message
Anita Kuno (anteaya) wrote :

As of right now, failures seem to have stopped on the 16th. Let's keep an eye on this one.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :
Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
milestone: none → icehouse-1
tags: added: havana-backport-potential
Changed in neutron:
milestone: icehouse-1 → 2013.2.1
tags: removed: havana-backport-potential
Alan Pevec (apevec)
Changed in neutron:
assignee: Robert Kukura (rkukura) → Armando Migliaccio (armando-migliaccio)
milestone: 2013.2.1 → icehouse-2
milestone: icehouse-2 → icehouse-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.