Skip to content

Commit 101e372

Browse files
Fix controller hang when submission exits early (#1695)
1 parent 15c547e commit 101e372

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

cms/grading/tasktypes/Interactive.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ def evaluate(self, job, file_cacher):
252252
stdin=subprocess.DEVNULL,
253253
stdout=subprocess.PIPE,
254254
)
255-
stdout, _ = p.communicate(timeout=self.controller_wall_limit * 2)
255+
try:
256+
stdout, _ = p.communicate(timeout=self.controller_wall_limit * 2)
257+
except subprocess.TimeoutExpired:
258+
p.kill()
259+
stdout, _ = p.communicate()
256260

257261
KEEPER_ERROR_MESSAGE = "Internal error in interactive keeper"
258262

cms/grading/tasktypes/interactive_keeper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ def main():
8787
for i in range(process_limit):
8888
c_to_u_r, c_to_u_w = os.pipe()
8989
u_to_c_r, u_to_c_w = os.pipe()
90-
os.set_inheritable(c_to_u_r, True)
9190
os.set_inheritable(c_to_u_w, True)
9291
os.set_inheritable(u_to_c_r, True)
93-
os.set_inheritable(u_to_c_w, True)
9492
pipes.append({"c_to_u": (c_to_u_r, c_to_u_w), "u_to_c": (u_to_c_r, u_to_c_w)})
9593

9694
controller_sandbox = Sandbox(0, shard, name="controller", temp_dir=temp_dir)

0 commit comments

Comments
 (0)