From 03d869d51cdb8c72016f2b74ed82bf9068e66b51 Mon Sep 17 00:00:00 2001 From: Edward Oakes Date: Fri, 11 Dec 2020 21:47:16 -0600 Subject: [PATCH] Hold GIL while submitting (actor) tasks (#12803) --- python/ray/_raylet.pyx | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/python/ray/_raylet.pyx b/python/ray/_raylet.pyx index 462ba3ade..72d8a45d3 100644 --- a/python/ray/_raylet.pyx +++ b/python/ray/_raylet.pyx @@ -1091,16 +1091,18 @@ cdef class CoreWorker: language.lang, function_descriptor.descriptor) prepare_args(self, language, args, &args_vector) - with nogil: - CCoreWorkerProcess.GetCoreWorker().SubmitTask( - ray_function, args_vector, CTaskOptions( - name, num_returns, c_resources, - c_override_environment_variables), - &return_ids, max_retries, - c_pair[CPlacementGroupID, int64_t]( - c_placement_group_id, placement_group_bundle_index), - placement_group_capture_child_tasks, - debugger_breakpoint) + # NOTE(edoakes): releasing the GIL while calling this method causes + # segfaults. See relevant issue for details: + # https://github.com/ray-project/ray/pull/12803 + CCoreWorkerProcess.GetCoreWorker().SubmitTask( + ray_function, args_vector, CTaskOptions( + name, num_returns, c_resources, + c_override_environment_variables), + &return_ids, max_retries, + c_pair[CPlacementGroupID, int64_t]( + c_placement_group_id, placement_group_bundle_index), + placement_group_capture_child_tasks, + debugger_breakpoint) return VectorToObjectRefs(return_ids) @@ -1238,12 +1240,14 @@ cdef class CoreWorker: language.lang, function_descriptor.descriptor) prepare_args(self, language, args, &args_vector) - with nogil: - CCoreWorkerProcess.GetCoreWorker().SubmitActorTask( - c_actor_id, - ray_function, - args_vector, CTaskOptions(name, num_returns, c_resources), - &return_ids) + # NOTE(edoakes): releasing the GIL while calling this method causes + # segfaults. See relevant issue for details: + # https://github.com/ray-project/ray/pull/12803 + CCoreWorkerProcess.GetCoreWorker().SubmitActorTask( + c_actor_id, + ray_function, + args_vector, CTaskOptions(name, num_returns, c_resources), + &return_ids) return VectorToObjectRefs(return_ids)