cms icon indicating copy to clipboard operation
cms copied to clipboard

Add ability to limit stack size for custom checker.

Open ghost opened this issue 9 years ago • 5 comments

Recently, I created a problem with a custom checker, in which I made a bug that causes an infinite recursive loop. Then the checker took forever to finish, caused my computer to freeze, then when I restart the computer (literally unplugged the power) and start cms again, the worker service re-ran the checker and my computer froze again... After that, I had to remove that problem from cms and everything became fine again. So what I'm asking here is how to limit the stack size using for custom checker (so it'll throw a segment fault if the stack size used is exceeded, like how it happens with users submissions), or if it hasn't been implemented yet, I hope you would do it. Or maybe it's just a problem on my side, if so, I'm using Ubuntu 14.04.5 64bit, what would have caused the problem ? Thank you. P.s: sorry for my english.

ghost avatar Dec 08 '16 03:12 ghost

AFAIK the checker (just like the compiler) is run inside the sandbox with quite high limits, e.g. time limit = 10 seconds, so it should never cause this kind of issues...

Are you sure the issue is caused by the checker?

wil93 avatar Dec 08 '16 08:12 wil93

Actually it looks like for Batch tasks, the checker is run with the same time and memory limits as the solution. Maybe you had the limits equal to 0 (which means no limits)?

Or maybe you were using OutputOnly or TwoSteps, which have no limits at all.

Maybe it's worth making all of them uniform to some absurdly large hard limits (just to avoid the possibility of a valid checker to be stopped incorrectly). Notice that the 10 seconds for compilation is a different matter, as that time is controllable by the contestants.

On 8 December 2016 at 08:51, William Di Luigi [email protected] wrote:

AFAIK the checker (just like the compiler) is run inside the sandbox with quite high limits, e.g. time limit = 10 seconds, so it should never cause this kind of issues...

Are you sure the issue is caused by the checker?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cms-dev/cms/issues/679#issuecomment-265686412, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdocnjMkHpNsQRWTIK6J7hThSgzW3nNks5rF8URgaJpZM4LHY6C .

stefano-maggiolo avatar Dec 08 '16 09:12 stefano-maggiolo

I'm pretty sure the checker caused the problem, as when I fixed that bug, everything went fine. And for that problem, I just change the test cases and add a checker, everything else is left as default (Batch tasks, TL 1s, ML 512MB).

ghost avatar Dec 09 '16 13:12 ghost

Actually it looks like for Batch tasks, the checker is run with the same time and memory limits as the solution. Maybe you had the limits equal to 0 (which means no limits)?

I'm sorry but I can't figure out where in the code the limits are set. It seems that the checker is executed in cms/grading/tasktypes/Batch.py#L358 where no limits are passed to evaluation_step. In this case I think sandox.timeout will be reset to 0 in cms/grading/__init__.py#L455.

Maybe related to #626?

wafrelka avatar Jan 27 '17 15:01 wafrelka

See comment for #626. As for here, I'm open to hear about the default memory limit (4GiB). Too large?

stefano-maggiolo avatar Apr 20 '18 16:04 stefano-maggiolo