Skip to content

Commit

Permalink
Add lock in fetch_and_execute_function_to_run of import_thread.py (#4718
Browse files Browse the repository at this point in the history
)
  • Loading branch information
guoyuhong authored and robertnishihara committed Apr 30, 2019
1 parent 4eade03 commit 448a7bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/ray/import_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ def fetch_and_execute_function_to_run(self, key):
return

try:
# Deserialize the function.
function = pickle.loads(serialized_function)
# FunctionActorManager may call pickle.loads at the same time.
# Importing the same module in different threads causes deadlock.
with self.worker.function_actor_manager.lock:
# Deserialize the function.
function = pickle.loads(serialized_function)
# Run the function.
function({"worker": self.worker})
except Exception:
Expand Down

0 comments on commit 448a7bd

Please sign in to comment.