← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1506934] [NEW] The exception type is wrong and makes the except block not work

 

Public bug reported:

With many ha routers, I restart the l3-agent.  And find error in the
log:

2015-10-14 22:24:19.640 31246 INFO eventlet.wsgi.server [-] Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 442, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 59, in __call__
    self.enqueue(router_id, state)
  File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 65, in enqueue
    self.agent.enqueue_state_change(router_id, state)
  File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 119, in enqueue_state_change
    ri = self.router_info[router_id]
KeyError: 'aec00e20-ebe0-4979-858b-cb411dcd1bb6'

Checking code, and find that

def enqueue_state_change(self, router_id, state):
        LOG.info(_LI('Router %(router_id)s transitioned to %(state)s'),
                 {'router_id': router_id,
                  'state': state})

        try:
            ri = self.router_info[router_id]
        except AttributeError:
            LOG.info(_LI('Router %s is not managed by this agent. It was '
                         'possibly deleted concurrently.'), router_id)
            return

KeyError should be expected here according to the context.

** Affects: neutron
     Importance: Undecided
     Assignee: Hong Hui Xiao (xiaohhui)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Hong Hui Xiao (xiaohhui)

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

Title:
  The exception type is wrong and makes the except block not work

Status in neutron:
  New

Bug description:
  With many ha routers, I restart the l3-agent.  And find error in the
  log:

  2015-10-14 22:24:19.640 31246 INFO eventlet.wsgi.server [-] Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 442, in handle_one_response
      result = self.application(self.environ, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
      return self.func(req, *args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 59, in __call__
      self.enqueue(router_id, state)
    File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 65, in enqueue
      self.agent.enqueue_state_change(router_id, state)
    File "/usr/lib/python2.7/dist-packages/neutron/agent/l3/ha.py", line 119, in enqueue_state_change
      ri = self.router_info[router_id]
  KeyError: 'aec00e20-ebe0-4979-858b-cb411dcd1bb6'

  Checking code, and find that

  def enqueue_state_change(self, router_id, state):
          LOG.info(_LI('Router %(router_id)s transitioned to %(state)s'),
                   {'router_id': router_id,
                    'state': state})

          try:
              ri = self.router_info[router_id]
          except AttributeError:
              LOG.info(_LI('Router %s is not managed by this agent. It was '
                           'possibly deleted concurrently.'), router_id)
              return

  KeyError should be expected here according to the context.

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


Follow ups