Skip to content

Commit

Permalink
vine: deserialize argument infile before forking (#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 authored Aug 7, 2024
1 parent dc3a2cd commit 7348e3e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions poncho/src/poncho/library_network_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,23 @@ def start_function(in_pipe_fd, thread_limit=1):
finally:
os.chdir(library_sandbox)
else:
try:
arg_infile = os.path.join(function_sandbox, "infile")
with open(arg_infile, "rb") as f:
event = cloudpickle.load(f)
except Exception:
stdout_timed_message(f"TASK {function_id} error: can't load the arguments from {arg_infile}")
return
p = os.fork()
if p == 0:
try:
stdout_timed_message(f"TASK {function_id} {function_name} arrives, starting to run in process {os.getpid()}")

# change the working directory to the function's sandbox
os.chdir(function_sandbox)

stdout_timed_message(f"TASK {function_id} {function_name} arrives, starting to run in process {os.getpid()}")

try:
exit_status = 1
# parameters are represented as infile.
with open("infile", "rb") as f:
event = cloudpickle.load(f)
except Exception:
stdout_timed_message(f"TASK {function_id} error: can't load the arguments from infile")
exit_status = 2
Expand Down

0 comments on commit 7348e3e

Please sign in to comment.