From 59d7b836bf029511a7befa40423582c509dcde79 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 7a673403f..b00729fa2 100644 --- a/dmoj/judge.py +++ b/dmoj/judge.py @@ -173,7 +173,8 @@ def grading_cleanup_wrapper(): self.current_submission_thread.daemon = True self.current_submission_thread.start() - if blocking: + # Submission may have been killed already, but block if it hasn't been. + if blocking and self.current_submission_thread is not None: self.current_submission_thread.join() def grade_cases(self, grader, cases, short_circuit=False, is_short_circuiting=False):