neutron/neutron/tests/unit
John Schwarz ddaee9f060 Keep reading stdout/stderr until after kill
Currently, when calling AsyncProcess.stop(), the code stops the stdout
and stderr readers and kills the process. There exists an end case (as
described in the bug report) in which after the readers have been
stopped the sub-process will generate a substantial amount of outputs to
either fd. Since the 'subprocess' module is launched with
subprocess.PIPE as stdout/stderr, and since Linux's pipes can be filled
to the point where writing new data to them will block, this may cause a
deadlock if the sub-process has a signal handler for the signal (for
example, the process is handling SIGTERM to produce a graceful exit of
the program).

Therefore, this patch proposes to only kill the readers until AFTER
wait() returned and the process truly died. Also, relying on _kill_event
had to cease since invoking its send() method caused a logical loop back
to _kill, causing eventlet errors.

A different possible solution is closing the stdout/stderr pipes. Alas,
this may raise an exception in the sub-process ("what? No stdout?!
Crash!") and defeats the 'graceful' part of the process.

Closes-Bug: #1506021
Change-Id: I506c41c634a8d656d81a8ad7963412b834bdfa5b
2015-11-19 19:14:13 +02:00
..
agent Keep reading stdout/stderr until after kill 2015-11-19 19:14:13 +02:00
api Merge "[rpc] pull: removed a hack to avoid object backport triggered" 2015-09-01 12:45:14 +00:00
callbacks Improve callback registry devref documentation and usability 2015-08-12 10:15:07 -07:00
cmd Add IPDevice.exists() method 2015-10-01 13:47:07 -04:00
common Merge "/common/utils.py py34 incompatibility" 2015-10-02 18:19:28 +00:00
core_extensions QoS core extension: fixed dict extension when QoS policy is unset 2015-08-08 15:44:27 +02:00
db Merge "Use assertIn and assertNotIn" 2015-10-06 00:19:43 +00:00
debug Reorganize unit test tree 2015-04-06 23:28:31 +00:00
extensions Use assertIsNone(observed) instead of assertEqual(None, observed) 2015-10-06 01:06:11 +02:00
hacking Restructure agent code in preparation for decomp 2015-06-26 15:06:49 +00:00
ipam Use assertIsNone(observed) instead of assertEqual(None, observed) 2015-10-06 01:06:11 +02:00
notifiers Use assertIsNone(observed) instead of assertEqual(None, observed) 2015-10-06 01:06:11 +02:00
objects Kill HEADS file 2015-09-25 12:53:37 +02:00
plugins Merge "Use assertIsNone(observed) instead of assertEqual(None, observed)" 2015-10-06 11:33:44 +00:00
quota Reduce the chance of random check/gate test failures 2015-09-09 14:45:16 -07:00
scheduler Simplify L3 HA scheduler tests 2015-10-01 12:01:27 -04:00
services Get rid of ConfigParser code in ProviderConfiguration 2015-09-21 10:55:56 -07:00
tests Merge "Different approach to indicate failure on SystemExit" 2015-07-16 06:57:16 +00:00
__init__.py oslo: migrate to namespace-less import paths 2015-02-05 15:09:32 +01:00
_test_extension_portbindings.py Context: Remove logic for read_deleted and deprecate it 2015-06-09 13:50:03 -07:00
dummy_plugin.py Remove lingering traces of q_ 2015-07-07 17:04:44 -04:00
extension_stubs.py Remove get_namespace from API extensions 2015-06-15 09:17:32 -04:00
test_auth.py oslo: migrate to namespace-less import paths 2015-02-05 15:09:32 +01:00
test_context.py Python 3: fix test_context 2015-07-27 16:57:08 +02:00
test_manager.py Flavor Framework implementation 2015-07-16 09:07:41 -07:00
test_policy.py Stop device_owner from being set to 'network:*' 2015-09-08 15:00:13 +00:00
test_service.py Refactor TestRpcWorker and TestWorkerService 2015-06-16 15:49:48 +03:00
test_wsgi.py Enable most unit tests for py34 job 2015-09-04 08:30:22 +00:00
testlib_api.py Improve fixture usage. 2015-07-01 14:53:48 +12:00