KITPraktomatTeam/Praktomat

Praktomat Timeout didn't work with every kind of checkers. <== Includes Patch for Praktomat/src/utilities/safeexec.py

ifrh opened this issue · 3 comments

ifrh commented

As announced via mailing list, we found, that the timeout implementation inside
Praktomat/src/utilities/safeexec.py didn't stop every kind of checker (i.e. ScriptCheckers) after the timeout.

The timeout of shell scripts like
Praktomat/src/checker/scripts/java
Praktomat/src/checker/scripts/javac
and other only worked because of their ulimit -t
Shell scripts without ulimit didn't get terminated or killed by Praktomat using case settings.USEPRAKTOMATTESTER == TRUE

with attached Patch file for Praktomat/src/utilities/safeexec.py
that problem was gone.

Attached file safeexec.py.PATCH.txt has unix lineending.

safeexec.py.PATCH.txt

Thanks!
Two short questions:

Is this TODO still relevant?

# TODO: should kill child or grandchild processes, but didn't if they are running as other linux users

Also, i wonder where those following print statements can actually be observed:

       print "**********************"
       print command
       print sudo_prefix
       print "**********************"
ifrh commented

Hi, the TODO is still relevant but only theoretical. because after the patchlines

-		command = sudo_prefix
+		#command = sudo_prefix
+		#fixed: 22.11.2016, Robert Hartmann
+		command = deepcopy(sudo_prefix)

the term_cmd , kill_cmd works fine for me.

That means: child and grandchild processes got terminated or killed via linux Session ID independend of the linux user.
But if term_cmd , kill_cmd didn't work for someone, there should be a fallback option, trying to kill/terminate the process-subtree from python.

You mentioned the print codelines:
I only forgot to remove the print codelines. I wrote the outputs to a file, that filewriting codelines I had removed, the printed lines could be seen, if you run the devel-Praktomat. or?

Best regards,
Robert
<Edit: for clarification 8.12.2016, 20:08>

ifrh commented

My fix for that bug is available in pullrequest #262 since Feb. 2017 and is working at our praktomat instances at H-BRS since Wintersemester 2016/2017.
Since than we hat no problems with non working timeouts.
Four years of testing could be enough prove to become a mergeable (or cherry-pickable) change for Praktomat/src/utilities/safeexec.py in #262 .