← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1364085] [NEW] DBDuplicateEntry: (IntegrityError) duplicate key value violates unique constraint "ipavailabilityranges_pkey"

 

Public bug reported:

It affects only postgresql
To reproduce this bug:

1) Create a network with few IPs (eg /29)
2) Create 2 VMs that use the /29 network.
3) Destroy the 2 VMs
4) From horizon create a number of VMs > IP available (eg. 8)

When there's no IP available, _rebuild_availability_ranges will be
called to recycle the IPs of the VMs  that no longer exist (the ones
that we created at step 2 ) . From the logs i see that when there's a
bulk creation of ports and the IP range is over, 2 or more
_rebuild_availability_ranges are triggered at the same time by different
port creation operation. This leads to the DBDuplicateEntry, since the
operation that is performed last, will try to insert in the DB stale
data.

See log:

 362399 2014-08-26 10:01:01.926 27821 DEBUG neutron.db.db_base_plugin_v2 [-] All IPs from subnet a77b383d-e881-49c1-8143-910ec46fe42a (10.238.192.0        /18) allocated _try_generate_ip /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:384
 362400 2014-08-26 10:01:01.927 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Rebuilding availability ranges for subnet {'allocation_pools': [{'star        t': u'10.238.200.129', 'end': u'10.238.200.254'}], 'host_routes': [], 'cidr': u'10.238.192.0/18', 'id': u'a77b383d-e881-49c1-8143-910ec46fe        42a', 'name': u'floating', 'enable_dhcp': False, 'network_id': u'a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a', 'tenant_id': u'774289027a8441babaed        f5774e49e971', 'dns_nameservers': [], 'gateway_ip': u'10.238.192.3', 'ip_version': 4, 'shared': False} _rebuild_availability_ranges /usr/li        b64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:414
 362401 2014-08-26 10:01:01.928 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Generated mac for network a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a is fa:1        6:3e:6f:f3:02 _generate_mac /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:305
 362402 2014-08-26 10:01:01.952 27821 INFO neutron.wsgi [-] 10.1.100.1 - - [26/Aug/2014 10:01:01] "GET /v2.0/subnets.json?id=fa32a700-57ce-4bfc-a2b        f-7fb19e20f81b HTTP/1.1" 200 504 0.091873
 362403 
 362404 2014-08-26 10:01:01.966 27821 INFO neutron.wsgi [-] (27821) accepted ('10.1.100.1', 21561)
 362405 
 362406 2014-08-26 10:01:01.977 27821 DEBUG neutron.db.db_base_plugin_v2 [-] All IPs from subnet a77b383d-e881-49c1-8143-910ec46fe42a (10.238.192.0        /18) allocated _try_generate_ip /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:384
 362407 2014-08-26 10:01:01.977 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Rebuilding availability ranges for subnet {'allocation_pools': [{'star        t': u'10.238.200.129', 'end': u'10.238.200.254'}], 'host_routes': [], 'cidr': u'10.238.192.0/18', 'id': u'a77b383d-e881-49c1-8143-910ec46fe        42a', 'name': u'floating', 'enable_dhcp': False, 'network_id': u'a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a', 'tenant_id': u'774289027a8441babaed        f5774e49e971', 'dns_nameservers': [], 'gateway_ip': u'10.238.192.3', 'ip_version': 4, 'shared': False} _rebuild_availability_ranges /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:414

** Affects: neutron
     Importance: Undecided
     Assignee: Rossella Sblendido (rossella-o)
         Status: New


** Tags: postgresql

** Changed in: neutron
     Assignee: (unassigned) => Rossella Sblendido (rossella-o)

** Tags added: postgresql

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1364085

Title:
  DBDuplicateEntry: (IntegrityError) duplicate key value violates unique
  constraint "ipavailabilityranges_pkey"

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  It affects only postgresql
  To reproduce this bug:

  1) Create a network with few IPs (eg /29)
  2) Create 2 VMs that use the /29 network.
  3) Destroy the 2 VMs
  4) From horizon create a number of VMs > IP available (eg. 8)

  When there's no IP available, _rebuild_availability_ranges will be
  called to recycle the IPs of the VMs  that no longer exist (the ones
  that we created at step 2 ) . From the logs i see that when there's a
  bulk creation of ports and the IP range is over, 2 or more
  _rebuild_availability_ranges are triggered at the same time by
  different port creation operation. This leads to the DBDuplicateEntry,
  since the operation that is performed last, will try to insert in the
  DB stale data.

  See log:

   362399 2014-08-26 10:01:01.926 27821 DEBUG neutron.db.db_base_plugin_v2 [-] All IPs from subnet a77b383d-e881-49c1-8143-910ec46fe42a (10.238.192.0        /18) allocated _try_generate_ip /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:384
   362400 2014-08-26 10:01:01.927 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Rebuilding availability ranges for subnet {'allocation_pools': [{'star        t': u'10.238.200.129', 'end': u'10.238.200.254'}], 'host_routes': [], 'cidr': u'10.238.192.0/18', 'id': u'a77b383d-e881-49c1-8143-910ec46fe        42a', 'name': u'floating', 'enable_dhcp': False, 'network_id': u'a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a', 'tenant_id': u'774289027a8441babaed        f5774e49e971', 'dns_nameservers': [], 'gateway_ip': u'10.238.192.3', 'ip_version': 4, 'shared': False} _rebuild_availability_ranges /usr/li        b64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:414
   362401 2014-08-26 10:01:01.928 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Generated mac for network a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a is fa:1        6:3e:6f:f3:02 _generate_mac /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:305
   362402 2014-08-26 10:01:01.952 27821 INFO neutron.wsgi [-] 10.1.100.1 - - [26/Aug/2014 10:01:01] "GET /v2.0/subnets.json?id=fa32a700-57ce-4bfc-a2b        f-7fb19e20f81b HTTP/1.1" 200 504 0.091873
   362403 
   362404 2014-08-26 10:01:01.966 27821 INFO neutron.wsgi [-] (27821) accepted ('10.1.100.1', 21561)
   362405 
   362406 2014-08-26 10:01:01.977 27821 DEBUG neutron.db.db_base_plugin_v2 [-] All IPs from subnet a77b383d-e881-49c1-8143-910ec46fe42a (10.238.192.0        /18) allocated _try_generate_ip /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:384
   362407 2014-08-26 10:01:01.977 27821 DEBUG neutron.db.db_base_plugin_v2 [-] Rebuilding availability ranges for subnet {'allocation_pools': [{'star        t': u'10.238.200.129', 'end': u'10.238.200.254'}], 'host_routes': [], 'cidr': u'10.238.192.0/18', 'id': u'a77b383d-e881-49c1-8143-910ec46fe        42a', 'name': u'floating', 'enable_dhcp': False, 'network_id': u'a4f3c5ac-de4a-44c5-94b8-bd07a14c4d1a', 'tenant_id': u'774289027a8441babaed        f5774e49e971', 'dns_nameservers': [], 'gateway_ip': u'10.238.192.3', 'ip_version': 4, 'shared': False} _rebuild_availability_ranges /usr/lib64/python2.6/site-packages/neutron/db/db_base_plugin_v2.py:414

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1364085/+subscriptions


Follow ups

References