Initilization VM problems when running Javacode with Python

Initilization VM problems when running Javacode with Python

de către Thomas Goerttler-
Număr de răspunsuri: 2

Dear all,

setup:
I do not have admin right. I am just a teaching assistant trying to create nice exercises
I have build a prototype based on python3 which compiles and runs C/Java files.
Normally everything works fine.
However, sometimes - I think especially after the prototype has change - the Javafiles are not compile in one tests, however in all other similar tests they are. Changing basically nothing and rechecking it, it starts working.
Students however will loose a try.

The compiler output is:

Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
As a quickfix I just try to compile the file 10 times (hoping that at some point it is initialized):

for _ in range(10):
    compiler = subprocess.Popen(compile_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
    STD[COUT], STD[CERR] = [s for s in compiler.communicate()]
    if "Error occurred during initialization of VM" not in STD[COUT]:
        break
However this somehow seems not right (although it worked so far) :D.
Also, I one tried to run the compile step for every test 10 times and 2 out of 10 tries (randomly distributed) failed.

Is there any way to prevent this error in coderunner?

Thanks a lot
Thomas
Ca răspuns la Thomas Goerttler

Re: Initilization VM problems when running Javacode with Python

de către Richard Lobb-

You've almost certainly hit either the default memory limit or process limit for the task on Jobe. Java is a resource hog, and running it from within Python doubly so. If you're getting intermittent failures you must be right on the borderline of one of those limits.

If you customise your question, then open the Advanced Customisation panel, you'll find a MemLimit (MB) field and a Parameters field for the sandbox. You can turn off Memory Limit checking by setting MemLimit to 0. This is pretty safe because the JVM itself enforces memory limits. If that doesn't solve the problem, raise the process limit for the task by setting the Parameters field to something of the form {"numprocs": 200}.

Ca răspuns la Richard Lobb

Re: Initilization VM problems when running Javacode with Python

de către Thomas Goerttler-

Thanks a lot.
The MemLimit had already been set to 0 (as you gave the hint https://coderunner.org.nz/mod/forum/discuss.php?d=386).
I will try to increase the numsprocs to 200.
I hope that solves the problem.


PS: As I want to use the same thing also for C (I probably will copy the protype at the end to have a fix unique ace-language) setting the MemLimit to 0 is probably more dangerous for C, is not it?