From 93342d8a3453163bcdeafcaa123170376fcf4e2f Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sun, 2 Mar 2025 11:12:07 +0000 Subject: [PATCH] Improve internal error when the compare script errors. This will include the exit code in the description of the internal error in order to make it more clear, as well as include the metadata. --- judge/judgedaemon.main.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index fa2beda90d..9fdb3754ec 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -1467,13 +1467,19 @@ function judge(array $judgeTask): bool } if ($result === 'compare-error') { + $compareMeta = read_metadata($passdir . '/compare.meta'); + $compareExitCode = 'n/a'; + if (isset($compareMeta['exitcode'])) { + $compareExitCode = $compareMeta['exitcode']; + } if ($combined_run_compare) { logmsg(LOG_ERR, "comparing failed for combined run/compare script '" . $judgeTask['run_script_id'] . "'"); - $description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed'; + $description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43"; disable('run_script', 'run_script_id', $judgeTask['run_script_id'], $description, $judgeTask['judgetaskid']); } else { logmsg(LOG_ERR, "comparing failed for compare script '" . $judgeTask['compare_script_id'] . "'"); - $description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed'; + logmsg(LOG_ERR, "compare script meta data:\n" . dj_file_get_contents($passdir . '/compare.meta')); + $description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43"; disable('compare_script', 'compare_script_id', $judgeTask['compare_script_id'], $description, $judgeTask['judgetaskid']); } return false;