← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1724043] [NEW] l3-agent network_update() can throw an excetion if router ex_gw_port is None

 

Public bug reported:

I've seen this error a couple of times in downstream testing, but looks
like it could be just as broken upstream:

2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server [req-a1152197-d8b1-4e34-ae63-8a94fd69ebcd faf66db1b6de4c56a9925b9e5aa3369d c977198dffa24e6f8e9e8c8c4cf3211c - - -] Exception during message handling: TypeError: 'NoneType' object has no attribute '__getitem__'
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 160, in _process_incoming
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     res = self.dispatcher.dispatch(message)
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 213, in dispatch
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return self._do_dispatch(endpoint, method, ctxt, args)
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 183, in _do_dispatch
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     result = func(ctxt, **new_args)
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 446, in network_update
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     if any(port_belongs(p) for p in ports):
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 446, in <genexpr>
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     if any(port_belongs(p) for p in ports):
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 445, in <lambda>
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     port_belongs = lambda p: p['network_id'] == network_id
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server TypeError: 'NoneType' object has no attribute '__getitem__'
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server

Since ri.ex_gw_port can be None, that can cause an exception when
looking for ports we might have in that network.  Here's an example if
the port is None:

  ports = itertools.chain(ri.internal_ports, [ri.ex_gw_port])

>>> import itertools
>>> foo = itertools.chain([], [None])
>>> port_belongs = lambda p: p['network_id'] == network_id
>>> any(port_belongs(p) for p in foo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <genexpr>
  File "<stdin>", line 1, in <lambda>
TypeError: 'NoneType' object has no attribute '__getitem__'

We need to check if it's None and use [] instead.

** Affects: neutron
     Importance: Medium
     Assignee: Brian Haley (brian-haley)
         Status: In Progress


** Tags: l3-ipam-dhcp

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

Title:
  l3-agent network_update() can throw an excetion if router ex_gw_port
  is None

Status in neutron:
  In Progress

Bug description:
  I've seen this error a couple of times in downstream testing, but
  looks like it could be just as broken upstream:

  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server [req-a1152197-d8b1-4e34-ae63-8a94fd69ebcd faf66db1b6de4c56a9925b9e5aa3369d c977198dffa24e6f8e9e8c8c4cf3211c - - -] Exception during message handling: TypeError: 'NoneType' object has no attribute '__getitem__'
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 160, in _process_incoming
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     res = self.dispatcher.dispatch(message)
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 213, in dispatch
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return self._do_dispatch(endpoint, method, ctxt, args)
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 183, in _do_dispatch
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     result = func(ctxt, **new_args)
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 446, in network_update
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     if any(port_belongs(p) for p in ports):
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 446, in <genexpr>
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     if any(port_belongs(p) for p in ports):
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 445, in <lambda>
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server     port_belongs = lambda p: p['network_id'] == network_id
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server TypeError: 'NoneType' object has no attribute '__getitem__'
  2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.rpc.server

  Since ri.ex_gw_port can be None, that can cause an exception when
  looking for ports we might have in that network.  Here's an example if
  the port is None:

    ports = itertools.chain(ri.internal_ports, [ri.ex_gw_port])

  >>> import itertools
  >>> foo = itertools.chain([], [None])
  >>> port_belongs = lambda p: p['network_id'] == network_id
  >>> any(port_belongs(p) for p in foo)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "<stdin>", line 1, in <genexpr>
    File "<stdin>", line 1, in <lambda>
  TypeError: 'NoneType' object has no attribute '__getitem__'

  We need to check if it's None and use [] instead.

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


Follow ups