-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Looking at isolate source it seems that --quota parameters are only used by command --init, while other commands (including --run) silently ignore it. ReCodEx passes --quota only to isolate --run, not to isolate --init.
Steps to reproduce:
I have tested this using the following program (submit to any C or C++ exercise). It writes to file big as much as it can, then terminates. Please do not run this in production*.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
char buff[1000];
for(int i = 0; i < 1000; i++)
buff[i] = rand();
FILE* fp = fopen("big", "w");
while(fwrite(buff, 1, 1000, fp) == 1000);
fclose(fp);
return 0;
}Expected behavior: When the quota is eventually reached, write syscall fails with EDQUOT, fwrite returns <1000, and the program terminates.
Observed behavior: The quota is exceeded and the file fills the disk.
You may need to add a sleep at the end of the program and check df -h /var/recodex-worker-wd concurrently in a shell.
* - In my setup, the isolate box and the ReCodEx Worker working directory are on the same filesystem, so the file cannot be copied out of the isolate box (ENOSPC). While the box does get properly cleaned up, the solution is left in the "work-in-progress" status forever (“The evaluation is not available yet. Click the refresh button for an update.”). YMMV.