← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1484135] Re: DetachedInstanceError on network delete

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

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

Title:
  DetachedInstanceError on network delete

Status in neutron:
  Fix Released

Bug description:
  DetachedInstanceError occures when logging "dhcp port was deleted
  concurrently" and accessing db object while it was already expunged
  from session. Code in question:

      def _delete_ports(self, context, ports):
          for port in ports:
              try:
                  self.delete_port(context, port.id)
              except (exc.PortNotFound, sa_exc.ObjectDeletedError):
                  context.session.expunge(port)
                  # concurrent port deletion can be performed by
                  # release_dhcp_port caused by concurrent subnet_delete
                  LOG.info(_LI("Port %s was deleted concurrently"), port.id)

  Traceback:

  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource Traceback (most recent call last):
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/neutron/api/v2/resource.py", line 83, in resource
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     result = method(request=request, **args)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/neutron/api/v2/base.py", line 490, in delete
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     obj_deleter(request.context, id, **kwargs)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/plugin.py", line 775, in delete_network
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     self._delete_ports(context, ports)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/plugin.py", line 686, in _delete_ports
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     LOG.info(_LI("Port %s was deleted concurrently"), port.id)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 239, in __get__
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     return self.impl.get(instance_state(instance), dict_)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 589, in get
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     value = callable_(state, passive)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/state.py", line 424, in __call__
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     self.manager.deferred_scalar_loader(self, toload)
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 563, in load_scalar_attributes
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource     (state_str(state)))
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource DetachedInstanceError: Instance <Port at 0x7f8f7d544dd0> is not bound to a Session; attribute refresh operation cannot proceed
  2015-08-12 09:26:42.976 4250 TRACE neutron.api.v2.resource
  2015-08-12T09:26:42.990805+00:00 info:  2015-08-12 09:26:42.987 4250 INFO neutron.wsgi [req-2bbc2b06-40f1-41e7-a230-3026ea94414d ] 10.109.2.3 - - [12/Aug/2015 09:26:42] "DELETE /v2.0/networks/a3322fce-2fc9-4be3-88d7-ba1d4f4294df.json HTTP/1.1" 500 378 0.938119

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


References