Add lock in fetch_and_execute_function_to_run of import_thread.py (#4718)

This commit is contained in:
Yuhong Guo
2019-05-01 01:47:16 +08:00
committed by Robert Nishihara
parent 4eade036a0
commit 448a7bd08d
+5 -2
View File
@@ -124,8 +124,11 @@ class ImportThread(object):
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: