From c267b5650572e9a40667200a07b939b9957879b8 Mon Sep 17 00:00:00 2001 From: Xyene Date: Mon, 16 Sep 2019 18:52:49 -0400 Subject: [PATCH] Patch up race condition exposed in #478 --- dmoj/judge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dmoj/judge.py b/dmoj/judge.py index 8ac26e34a..ecaf365ed 100644 --- a/dmoj/judge.py +++ b/dmoj/judge.py @@ -115,7 +115,8 @@ def process_submission(self, type, target, id, *args, **kwargs): self.current_submission_thread.daemon = True self.current_submission_thread.start() - if is_blocking: + # Submission may have been killed already, but block if it hasn't been. + if is_blocking and self.current_submission_thread is not None: self.current_submission_thread.join() def _custom_invocation(self, language, source, memory_limit, time_limit, input_data):