Repository navigation
fix issue #1732 - #1733
fix issue #1732#1733jlohse-mpi-sws wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1733 +/- ##
==========================================
+ Coverage 56.72% 56.82% +0.10%
==========================================
Files 344 344
Lines 28314 28374 +60
==========================================
+ Hits 16060 16123 +63
+ Misses 12254 12251 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
veluca93
left a comment
There was a problem hiding this comment.
Looks like some test was relying on the previous behaviour, could you check?
|
Yes sorry. The issue was that my change prioritized controller failures over contestant failures, but it has to be the other way around in case the controller fails because of waiting for the contestant. |
|
If the controller fails because of waiting for the contestant, doesn't that indicate a bug in the controller or a too-low controller wall time limit? So I would expect "controller failed" in this case. |
|
Somewhat off-topic: Are the sandboxes intentionally not cleaned up in the "invalid command from controller" branch? |
In the current implementation there is only one wall time limit (controller_wall_limit) and the contestant gets the same wall limit. Therefore, if the contestant sleeps, the controller (who is started first) will likely time out first. People have been saying it is too hard to reliably find out in general whether the controller died because the contestant took too long, it guess this is why it is implemented like this @veluca93 ? |
|
Thanks for your explanation. I hadn't realized that the solution and the controller have the same wall time limit. So with the current implementation, I suppose a solution can force (success=False,"Controller Failed") by sleeping for a little less than the wall time limit and then quitting. (Not sure how problematic this is if done intentionally, but couldn't something to this effect also happen accidentally and then the participant would never learn the result of their submission?) This implementation also means that the stub has to check every input from the controller for completeness before handing it to the contestant's code as the controller could have been killed while writing, right? |
Yes, hence we should prioritize contestant failures over controller failures.
I don't think this is true (time limits are somewhat extended), but I am happy to be proven wrong with an adversarial example.
I don't understand this. If the controller fails, there is clearly a problem with the task. |
I'm not sure what you mean by time limits being extended or how that would help. (The controller and solution have exactly the same wall time limit. There is an extra_time setting in isolate, but that only applies to the cpu time, not wall time.) Here's a concrete example (encountered by Lukas Michel): #include <cstdio>
#include <ctime>
int main() {
// Wait for 0.5 seconds before starting the solution.
// (In practice, the controller would do other things, like read input or run several solutions in a row.)
timespec t{0,500000000};
nanosleep(&t, nullptr);
printf("START_SOLUTION\n");
fflush(stdout);
int fdin, fdout;
if (scanf("%d %d", &fdin, &fdout) != 2)
return 1;
FILE* to_solution = fdopen(fdin, "w");
FILE* from_solution = fdopen(fdout, "r");
int a;
if (fscanf(from_solution, "%d", &a) == 1 && a == 42) {
fprintf(stderr, "SCORE: 1\n");
fprintf(stderr, "USER_MESSAGE: translate:success\n");
} else {
fprintf(stderr, "SCORE: 0\n");
fprintf(stderr, "USER_MESSAGE: translate:wrong\n");
}
fclose(to_solution);
fclose(from_solution);
return 0;
}Correct solution: #include <cstdio>
int main() {
printf("42\n");
return 0;
}Wrong solution: #include <cstdio>
int main() {
int a;
scanf("%d", &a);
return 0;
}Empty input file. The solution and controller wait for input until the controller is killed due to exceeding its wall limit. Then, the solution terminates gracefully because its stdin pipe reads EOF. This is reported as a controller failure. |
I think that the controller failing should indicate a problem with the task, but that is not the case with the current implementation. See above for an example. Also, if the controller couldn't fail, why would we have to prioritize contestant failures over controller failures? I'm probably misunderstanding what you wrote... My suggestion would be that we have a separate controller wall time limit that is sufficiently large compared to the solution wall limit that no matter what the solution does, the controller will never run out of time. We would then report any controller failure as a failed evaluation (success=False). This would bring the situation to the attention of the contest administrators. (A failed controller would indeed indicate a problem with the task that should be fixed!) |
|
@fagu I had a LLM code up the following:
WDYT? |
|
Thanks. That's an interesting idea. I haven't really thought it through yet, so just a few quick comments for now:
What about the following simpler approach (very close to the status quo) also inspired by your new idea:
The reasoning is as follows: We are always unable to distinguish whether a deadlock is the controller's fault or the solution's fault, so (assuming the controller to be correct) we blame the solution for any exceeded wall limit. If the controller fails to due wall limit, that might cause the solution to crash due to receiving incomplete input from the controller or due to SIGPIPE (and the correct verdict would be "wall limit exceeded"). In the other direction, a crashed solution cannot cause the controller to exceed its wall limit. What do you think about this approach? (I would also like to think about it more carefully myself. It feels a bit scary to allow the solution to crash due to the controller exceeding the wall time limit, but I don't see a problem with it right now.) |
|
I think this is reasonable, although I would propose two changes:
WDYT? |
No description provided.