yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #80064
[Bug 1844500] Re: get_cmdline_from_pid may fail
Reviewed: https://review.opendev.org/682840
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3330bc01cbdecb12be9c30d78f648710f374d23e
Submitter: Zuul
Branch: master
commit 3330bc01cbdecb12be9c30d78f648710f374d23e
Author: Jens Harbott <j.harbott@xxxxxxxx>
Date: Wed Sep 18 08:46:58 2019 +0000
Fix race condition when getting cmdline
Even though we check for the existence of the process before, it may
still terminate before we get to read its command line, so catch the
error that can occur here.
Change-Id: I3e89aca8bedfd2912effe2490718223f7d03133e
Closes-Bug: 1844500
** Changed in: neutron
Status: In Progress => Fix Released
--
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:
Fix Released
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
References