Skip to content

Commit

Permalink
Don't try to update aborted judgings
Browse files Browse the repository at this point in the history
This (typically?) happens while cancelling a rejudging while
there are judgedaemons actively judging. Fixes errors like
```
[Nov 23 13:34:53.075] judgedaemon[526392]: warning: Error while executing curl POST to url http://localhost/domjudge/api/judgehosts/add-judging-run/tiger-1/1555747: http status code: 500, request size = 67745, response: array (
  'code' => 500,
  'message' => 'internal bug: the evaluated result changed during judging',
  'class' => 'BadMethodCallException',
  'trace' =>
  array (
    0 =>
    array (
      'namespace' => '',
      'short_class' => '',
      'class' => '',
      'type' => '',
      'function' => '',
      'file' => '/home/jaap/domjudge/git/domjudge/webapp/src/Controller/API/JudgehostController.php',
      'line' => 1053,
      'args' =>
      array (
      ),
    ),
...
```

(cherry picked from commit cb37af5)
  • Loading branch information
eldering authored and nickygerritsen committed Nov 23, 2024
1 parent 22764f3 commit edab328
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,12 @@ private function addSingleJudgingRun(
// Only update if the current result is different from what we had before.
// This should only happen when the old result was NULL.
if ($oldResult !== $result) {
if ($oldResult === 'aborted') {
// This judging was cancelled while we worked on it,
// probably as part of a cancelled rejudging.
// Throw away our work, and return that we're done.
return false;
}
if ($oldResult !== null) {
throw new BadMethodCallException('internal bug: the evaluated result changed during judging');
}
Expand Down

0 comments on commit edab328

Please sign in to comment.