← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1844500] [NEW] get_cmdline_from_pid may fail

 

Public bug reported:

Even though get_cmdline_from_pid() checks for the existence of the PID
before accessing the cmdline, the process may terminate just in between,
causing an IOError. So we need to catch that exception.

>From https://zuul.opendev.org/t/openstack/build/3a93ef0d0bbd40dc84758682dbc7b049:
        
ft1.40: neutron.tests.functional.agent.test_firewall.FirewallTestCase.test_egress_udp_rule(OVS Firewall Driver)_StringException: Traceback (most recent call last):
  File "neutron/tests/base.py", line 180, in func
    return f(self, *args, **kwargs)
  File "neutron/tests/functional/agent/test_firewall.py", line 498, in test_egress_udp_rule
    self._test_rule(self.tester.EGRESS, self.tester.UDP)
  File "neutron/tests/functional/agent/test_firewall.py", line 464, in _test_rule
    direction=direction)
  File "neutron/tests/common/conn_testers.py", line 205, in assert_no_connection
    self.assert_connection(direction, protocol, src_port, dst_port)
  File "neutron/tests/common/conn_testers.py", line 49, in wrap
    return f(self, direction, *args, **kwargs)
  File "neutron/tests/common/conn_testers.py", line 200, in assert_connection
    testing_method(direction, protocol, src_port, dst_port)
  File "neutron/tests/common/conn_testers.py", line 161, in _test_transport_connectivity
    nc_tester.test_connectivity()
  File "neutron/tests/common/net_helpers.py", line 526, in test_connectivity
    self.client_process.writeline(testing_string)
  File "neutron/tests/common/net_helpers.py", line 476, in client_process
    self.establish_connection()
  File "neutron/tests/common/net_helpers.py", line 503, in establish_connection
    self._spawn_server_process()
  File "neutron/tests/common/net_helpers.py", line 489, in _spawn_server_process
    listen=True)
  File "neutron/tests/common/net_helpers.py", line 554, in _spawn_nc_in_namespace
    proc = RootHelperProcess(cmd, namespace=namespace)
  File "neutron/tests/common/net_helpers.py", line 300, in __init__
    self._wait_for_child_process()
  File "neutron/tests/common/net_helpers.py", line 333, in _wait_for_child_process
    "in %d seconds" % (self.cmd, timeout)))
  File "neutron/common/utils.py", line 701, in wait_until_true
    while not predicate():
  File "neutron/tests/common/net_helpers.py", line 325, in child_is_running
    self.pid, self.cmd, run_as_root=True)
  File "neutron/agent/linux/utils.py", line 296, in get_root_helper_child_pid
    if pid_invoked_with_cmdline(pid, expected_cmd):
  File "neutron/agent/linux/utils.py", line 356, in pid_invoked_with_cmdline
    cmd = get_cmdline_from_pid(pid)
  File "neutron/agent/linux/utils.py", line 326, in get_cmdline_from_pid
    with open('/proc/%s/cmdline' % pid, 'r') as f:
IOError: [Errno 2] No such file or directory: '/proc/2866/cmdline

** Affects: neutron
     Importance: Undecided
     Assignee: Dr. Jens Harbott (j-harbott)
         Status: In Progress

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

Title:
  get_cmdline_from_pid may fail

Status in neutron:
  In Progress

Bug description:
  Even though get_cmdline_from_pid() checks for the existence of the PID
  before accessing the cmdline, the process may terminate just in
  between, causing an IOError. So we need to catch that exception.

  From https://zuul.opendev.org/t/openstack/build/3a93ef0d0bbd40dc84758682dbc7b049:
          
  ft1.40: neutron.tests.functional.agent.test_firewall.FirewallTestCase.test_egress_udp_rule(OVS Firewall Driver)_StringException: Traceback (most recent call last):
    File "neutron/tests/base.py", line 180, in func
      return f(self, *args, **kwargs)
    File "neutron/tests/functional/agent/test_firewall.py", line 498, in test_egress_udp_rule
      self._test_rule(self.tester.EGRESS, self.tester.UDP)
    File "neutron/tests/functional/agent/test_firewall.py", line 464, in _test_rule
      direction=direction)
    File "neutron/tests/common/conn_testers.py", line 205, in assert_no_connection
      self.assert_connection(direction, protocol, src_port, dst_port)
    File "neutron/tests/common/conn_testers.py", line 49, in wrap
      return f(self, direction, *args, **kwargs)
    File "neutron/tests/common/conn_testers.py", line 200, in assert_connection
      testing_method(direction, protocol, src_port, dst_port)
    File "neutron/tests/common/conn_testers.py", line 161, in _test_transport_connectivity
      nc_tester.test_connectivity()
    File "neutron/tests/common/net_helpers.py", line 526, in test_connectivity
      self.client_process.writeline(testing_string)
    File "neutron/tests/common/net_helpers.py", line 476, in client_process
      self.establish_connection()
    File "neutron/tests/common/net_helpers.py", line 503, in establish_connection
      self._spawn_server_process()
    File "neutron/tests/common/net_helpers.py", line 489, in _spawn_server_process
      listen=True)
    File "neutron/tests/common/net_helpers.py", line 554, in _spawn_nc_in_namespace
      proc = RootHelperProcess(cmd, namespace=namespace)
    File "neutron/tests/common/net_helpers.py", line 300, in __init__
      self._wait_for_child_process()
    File "neutron/tests/common/net_helpers.py", line 333, in _wait_for_child_process
      "in %d seconds" % (self.cmd, timeout)))
    File "neutron/common/utils.py", line 701, in wait_until_true
      while not predicate():
    File "neutron/tests/common/net_helpers.py", line 325, in child_is_running
      self.pid, self.cmd, run_as_root=True)
    File "neutron/agent/linux/utils.py", line 296, in get_root_helper_child_pid
      if pid_invoked_with_cmdline(pid, expected_cmd):
    File "neutron/agent/linux/utils.py", line 356, in pid_invoked_with_cmdline
      cmd = get_cmdline_from_pid(pid)
    File "neutron/agent/linux/utils.py", line 326, in get_cmdline_from_pid
      with open('/proc/%s/cmdline' % pid, 'r') as f:
  IOError: [Errno 2] No such file or directory: '/proc/2866/cmdline

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


Follow ups