neutron/neutron/tests/unit/agent
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
..
common Use assertIsNone(observed) instead of assertEqual(None, observed) 2015-10-06 01:06:11 +02:00
dhcp Prevent full sync in dhcp_agent when possible 2015-09-15 23:09:22 +05:30
l2 No network devices on network attached qos policies 2015-09-16 15:11:04 +02:00
l3 Merge "Use assertIsNone(observed) instead of assertEqual(None, observed)" 2015-10-06 11:33:44 +00:00
linux Keep reading stdout/stderr until after kill 2015-11-19 19:14:13 +02:00
metadata metadata: don't crash proxy on non-unicode user data 2015-10-01 16:56:10 -04:00
ovsdb ovsdb: attempt to enable connection_uri for native impl on startup 2015-06-25 10:09:42 +02:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test_rpc.py Fix a microsecond format of isoformat() 2015-07-28 13:54:56 +09:00
test_securitygroups_rpc.py Process user iptables rules before INVALID 2015-09-01 22:10:32 -07:00