Defend against reading before runguard is done writing#3482
Defend against reading before runguard is done writing#3482vmcj wants to merge 1 commit intoDOMjudge:mainfrom
Conversation
|
I don't believe the race condition as you describe it can exist. Please let me know what I am missing. The judgedaemon calls runguard in synchronous fashion, should never do it asynchronously. In
So, we wait until runguard is completely done with its execution before continueing with other code flow within judgedaemon. That means it is guaranteed that the runguard has completed all of its work before calling |
I was testing for another PR where I kill the judgedaemon after 30s (
timeout 30s ./bin/judgedaemon -n2), I suspect the judgedaemon gets a signal here, sends it to runguard which kills the submission but is not done writing yet, the judgedaemon already starts reading the file which is still empty (verified that by outputting it in the judgedaemon) but has values after the judgedaemon exits.This check should fix that racecondition but as this is such a specific case I'm not sure if we want to slow ourselves down by reading such files twice?