-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactive problem: pipes can fill up #113
Comments
I guess the judge error problem appears when the submission exits nicely, but the validator gets walltime limit exceeded due to this behavior? If so, the judge error is probably the result of the pipe closing logic added in #77:
looks like we traded one judge error for another... One solution would be to just give TLE/idleness limit exceeded in that case, just like I'd expect to happen if the submission doesn't exit nicely (e.g. because it spams the validator with queries which deadlock). I agree that it's not optimal though, and having it magically work would be better. Another solution would be to have an IO proxy process in between validator and submission, but that doubles the time overhead for interactive problems. Let's try not to require validators to handle signals in weird ways, that's a recipe for making different interactive problems behave differently. For |
That sounds reasonable.
To be clear, I am using the release version of problemtools, i.e. before #77 was merged. So I don't think the JE is caused by the new code.
I think what the correct judgement is is debatable.
Yes.
Right. |
The latest release (which is what I assume you mean by "the release version") was made after #77 was merged. I have also been pondering the idea of having an IO proxy between validator and submission, as it would also allow us to "record" and log the interaction done. I agree that it adds some IO overhead but (a) I/O usually isn't a bottleneck for interactive problems, and (b) I would consider this proxy to be a wrapper around the validator (i.e. the time spent would be taken from the validator's (generous) time budget and not affect the submissions). Another quick mitigation/bandaid for this issue would be to bump the buffer size of the pipes (I think the default is 64 KiB and bumping it to say 1 MiB is probably pretty risk-free?) |
It also increases context switches. It's actually a somewhat real problem -- there are interactive problems like https://boi18-day1.kattis.com/problems/boi18.worm that require hundreds of thousands of queries to become interesting.
For sure. It's just a question of walltime overhead.
That sounds great. |
I'm currently working on implementing this in DOMjudge, because logging the submission output is crucial for debugging and the jury's understanding.
It's 64KiB in the Linux kernel by default, but can be increased via Finally, I would say that a submission with this behavior should not trigger any verdicts except AC/WA depending on whether it gives the right output. |
👍 |
I've updated the interactive runner in problemtools to bump the pipe size to 1 MB. (@ghamerly the test submission in the problem you sent me still fills up the pipe and blocks, but it gets a few test cases further than it used to so... progress...?) |
This is a quick workaround to the issue reported in Kattis/problemtools#113
This is a quick workaround to the issue reported in Kattis/problemtools#113 (cherry picked from commit 9c5d0a8)
This is a quick workaround to the issue reported in Kattis/problemtools#113 (cherry picked from commit 9c5d0a8) (cherry picked from commit ecef070)
I'm not sure if this is something that can/should be handled by problemtools, or not, but it may be good if it could be handled there.
An interactive validator can get blocked on a write to standard output if the submission it is evaluating is not consuming that information. The pipe connecting the two programs fills up. When the interactive validator gets blocked, that can cause a judge error, because the validator does not get to exit cleanly.
Here's a scenario where this happened to me. In a loop, the submission makes one query to the validator, and the validator replies with two lines of response. The problem is such that a "reasonable" strategy is for the submission to just submit a bunch of random queries and ignore all responses. The validator gets stuck when trying to reply to a query.
This can be handled from within the validator by using
O_NONBLOCK
on standard output, and catching any errors that come from trying to write to a blocked file. But as I wrote initially, if there is some way the interactive validator could handle this issue, it would be nice.The text was updated successfully, but these errors were encountered: