From 93d54110f8d3812a0dc009b92994c25ea3cd1f6d Mon Sep 17 00:00:00 2001 From: Si-Yuan Date: Mon, 31 Dec 2018 16:36:26 -0800 Subject: [PATCH] Prevent overriding faulthandler settings (#3668) This change ensures that Ray set up fault handlers only if it has not been enabled by other applications. Otherwise some applications could face strange issues when using Ray, and some unittests using xml runners will fail. --- python/ray/worker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ray/worker.py b/python/ray/worker.py index aa45719ec..ced1f1cb8 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -1830,7 +1830,8 @@ def connect(ray_params, assert worker.cached_functions_to_run is not None, error_message # Enable nice stack traces on SIGSEGV etc. - faulthandler.enable(all_threads=False) + if not faulthandler.is_enabled(): + faulthandler.enable(all_threads=False) if ray_params.collect_profiling_data: worker.profiler = profiling.Profiler(worker)