← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1602794] [NEW] ItemAllocator class can throw a ValueError when file is corrupted

 

Public bug reported:

While running tests for an unrelated change, I saw this failure:

neutron.tests.unit.agent.l3.test_dvr_fip_ns.TestDvrFipNs.test_subscribe
-----------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "neutron/tests/unit/agent/l3/test_dvr_fip_ns.py", line 40, in setUp
        use_ipv6=True)
      File "neutron/agent/l3/dvr_fip_ns.py", line 57, in __init__
        FIP_PR_END)
      File "neutron/agent/l3/fip_rule_priority_allocator.py", line 53, in __init__
        pool)
      File "neutron/agent/l3/item_allocator.py", line 46, in __init__
        key, saved_value = line.strip().split(delimiter)
    ValueError: need more than 1 value to unpack

This is due to the fact that all the tests in this file using the
ItemAllocator class are using/re-using the same files in /tmp, and when
the right ones are run simultaneously, the file can be truncated,
leading to a corruption.  To recreate it you just have to do this:

$ echo "111.2.3.466652" > /tmp/fip-priorities
$ tox -e py27 neutron.tests.unit.agent.l3.test_dvr_fip_ns.TestDvrFipNs.test_subscribe

So the tests need to change to use unique files, and clean them up on
exit.

But it also shows that the ItemAllocator class cannot deal with a
corrupt file.  In this case we should catch the error and skip the
invalid entry, since it could cause the l3-agent to not start.

The same is probably true of other files in /tmp the tests are using as
well.

** Affects: neutron
     Importance: High
     Assignee: Brian Haley (brian-haley)
         Status: New


** Tags: l3-dvr-backlog

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

Title:
  ItemAllocator class can throw a ValueError when file is corrupted

Status in neutron:
  New

Bug description:
  While running tests for an unrelated change, I saw this failure:

  neutron.tests.unit.agent.l3.test_dvr_fip_ns.TestDvrFipNs.test_subscribe
  -----------------------------------------------------------------------

  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "neutron/tests/unit/agent/l3/test_dvr_fip_ns.py", line 40, in setUp
          use_ipv6=True)
        File "neutron/agent/l3/dvr_fip_ns.py", line 57, in __init__
          FIP_PR_END)
        File "neutron/agent/l3/fip_rule_priority_allocator.py", line 53, in __init__
          pool)
        File "neutron/agent/l3/item_allocator.py", line 46, in __init__
          key, saved_value = line.strip().split(delimiter)
      ValueError: need more than 1 value to unpack

  This is due to the fact that all the tests in this file using the
  ItemAllocator class are using/re-using the same files in /tmp, and
  when the right ones are run simultaneously, the file can be truncated,
  leading to a corruption.  To recreate it you just have to do this:

  $ echo "111.2.3.466652" > /tmp/fip-priorities
  $ tox -e py27 neutron.tests.unit.agent.l3.test_dvr_fip_ns.TestDvrFipNs.test_subscribe

  So the tests need to change to use unique files, and clean them up on
  exit.

  But it also shows that the ItemAllocator class cannot deal with a
  corrupt file.  In this case we should catch the error and skip the
  invalid entry, since it could cause the l3-agent to not start.

  The same is probably true of other files in /tmp the tests are using
  as well.

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


Follow ups