diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-07-23 16:30:32 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-07-24 15:26:36 -0500 |
commit | 97852aba2393a20fd5e0c25313d26be4ce316a25 (patch) | |
tree | f223a77d234f5c891f9094ef86f3e0e050c19b98 /mpm/python/usrp_hwd.py | |
parent | 54d698e3707cf1be5d38537db783ebadd850e729 (diff) | |
download | uhd-97852aba2393a20fd5e0c25313d26be4ce316a25.tar.gz uhd-97852aba2393a20fd5e0c25313d26be4ce316a25.tar.bz2 uhd-97852aba2393a20fd5e0c25313d26be4ce316a25.zip |
mpm: Fix gevent errors on SIGTERM
Sometimes when running usrp_hwd.py in a terminal and then canceling it
with Ctrl+C, it prints a really large stacktrace into the terminal
resulting from an uncaught gevent BlockingSwitchOutError. It seems like
there was an attempt to catch this in usrp_hwd.py:kill_time(). This
try-except was surrounding a call to Process.join() which, to the best
of my knowledge, can't ever throw this exception.
Based on my troubleshooting, this error comes from the SIGTERM signal
handler of the RPC process. The handler (defined in
rpc_server.py:_rpc_server_process), is just a direct call to
RPCServer.stop(). When the server's backed is a thread pool, this call
may block when joining the thread pool, causing gevent to complain about
execution attempting to block in a signal handler.
This commit resolves this issue by simply triggering an event in the
signal handler which prompts a different thread to clean up the server
and end the process.
Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'mpm/python/usrp_hwd.py')
-rwxr-xr-x | mpm/python/usrp_hwd.py | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/mpm/python/usrp_hwd.py b/mpm/python/usrp_hwd.py index f79932231..3523fa9b4 100755 --- a/mpm/python/usrp_hwd.py +++ b/mpm/python/usrp_hwd.py @@ -102,10 +102,7 @@ def kill_time(sig, frame): proc.terminate() log.info("Terminating pid: {0}".format(proc.pid)) for proc in _PROCESSES: - try: proc.join() - except BlockingSwitchOutError: - log.debug("Caught BlockingSwitchOutError for {}".format(str(proc))) log.info("System exiting") sys.exit(0) |