Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cms/grading/tasktypes/Interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ def evaluate(self, job, file_cacher):
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
)
stdout, _ = p.communicate(timeout=self.controller_wall_limit * 2)
try:
stdout, _ = p.communicate(timeout=self.controller_wall_limit * 2)
except subprocess.TimeoutExpired:
p.kill()
stdout, _ = p.communicate()

KEEPER_ERROR_MESSAGE = "Internal error in interactive keeper"

Expand Down
5 changes: 2 additions & 3 deletions cms/grading/tasktypes/interactive_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ def main():
for i in range(process_limit):
c_to_u_r, c_to_u_w = os.pipe()
u_to_c_r, u_to_c_w = os.pipe()
os.set_inheritable(c_to_u_r, True)
os.set_inheritable(c_to_u_w, True)
os.set_inheritable(u_to_c_r, True)
os.set_inheritable(u_to_c_w, True)
pipes.append({"c_to_u": (c_to_u_r, c_to_u_w), "u_to_c": (u_to_c_r, u_to_c_w)})

controller_sandbox = Sandbox(0, shard, name="controller", temp_dir=temp_dir)
Expand Down Expand Up @@ -165,7 +163,8 @@ def main():
wait=False,
)

os.close(p["c_to_u"][0])
# We do not close p["c_to_u"][0] -- it only risks crashing the
# controller with SIGPIPE if the submission exits early.
Comment thread
veluca93 marked this conversation as resolved.
Outdated
os.close(p["u_to_c"][1])

try:
Expand Down
Loading