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

Bug #1506934 reported by Hong Hui Xiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Hong Hui Xiao

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.

Hong Hui Xiao (xiaohhui)
Changed in neutron:
assignee: nobody → Hong Hui Xiao (xiaohhui)
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/236008

Changed in neutron:
status: New → In Progress
Assaf Muller (amuller)
Changed in neutron:
importance: Undecided → Medium
tags: added: l3-ha
tags: added: kilo-backport-potential
tags: added: liberty-backport-potential
Changed in neutron:
assignee: Hong Hui Xiao (xiaohhui) → Assaf Muller (amuller)
Assaf Muller (amuller)
Changed in neutron:
assignee: Assaf Muller (amuller) → Hong Hui Xiao (xiaohhui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/236008
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9d6584120003f50782461677d1b783bd07131444
Submitter: Jenkins
Branch: master

commit 9d6584120003f50782461677d1b783bd07131444
Author: Hong Hui Xiao <email address hidden>
Date: Fri Oct 16 12:39:32 2015 -0400

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

    According to the context, it should be KeyError here to catch.
    AttributeError will not happen here. More details could be found
    in the bug report.

    Change-Id: Id6351172703ac492e86475f75bf1be03f4e4e8a3
    Closes-bug: #1506934

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/236885

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

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/236886

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

Reviewed: https://review.openstack.org/236885
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=6308d78259cef26eace366a07c75abfa34840438
Submitter: Jenkins
Branch: stable/kilo

commit 6308d78259cef26eace366a07c75abfa34840438
Author: Hong Hui Xiao <email address hidden>
Date: Fri Oct 16 12:39:32 2015 -0400

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

    According to the context, it should be KeyError here to catch.
    AttributeError will not happen here. More details could be found
    in the bug report.

    Change-Id: Id6351172703ac492e86475f75bf1be03f4e4e8a3
    Closes-bug: #1506934
    (cherry picked from commit 9d6584120003f50782461677d1b783bd07131444)

tags: added: in-stable-kilo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/236886
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=0b5285aeccb482617b676e2c1278f829adc8cc2a
Submitter: Jenkins
Branch: stable/liberty

commit 0b5285aeccb482617b676e2c1278f829adc8cc2a
Author: Hong Hui Xiao <email address hidden>
Date: Fri Oct 16 12:39:32 2015 -0400

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

    According to the context, it should be KeyError here to catch.
    AttributeError will not happen here. More details could be found
    in the bug report.

    Change-Id: Id6351172703ac492e86475f75bf1be03f4e4e8a3
    Closes-bug: #1506934
    (cherry picked from commit 9d6584120003f50782461677d1b783bd07131444)

tags: added: in-stable-liberty
tags: removed: kilo-backport-potential
tags: removed: liberty-backport-potential
Changed in neutron:
status: Fix Committed → Fix Released
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.