maths / stack_util_maximapool

Pooling solution for starting up maxima processes so that moodle-qtype_stack does not need to wait.
10 stars 14 forks source link

Problem with the test form #13

Closed bennysalewski closed 10 years ago

bennysalewski commented 10 years ago

Hey,

The test form doesn't work. The request takes too long and the my server respones to console input very slow, if I've sent the request. If I use the maxime console on my server and enter e.g. "1+1;", it works fine. I've installed STACK as moodle plugin and tomcat7.

maximapool.conf (only changes):

maxima.load = false file.handling = false maxima.path.command = false

tia, frezziii

aharjula commented 10 years ago

Are you sure that "maxima.commandline" is correct for your installation (linux distribution?) and that your tomcat does not forbid you from running commands? Maybe you should check the logs generated by tomcat for obvious errors related to security policies or access problems.

bennysalewski commented 10 years ago

I'm using ubuntu server and the path to maxima console is correct (I can start it with terminal). I've looked through the logs from tomcat and one error appears frequently:

Servlet.service() for servlet [MaximaPool] in context with path [MaximaPool] threw exception java.lang.IllegalStateException: Cannot call sendError() after response has been committed

aharjula commented 10 years ago

The only bit that could call sendError is the status and health check handler in fi.aalto.maximapool.MaximaServlet.doGet(), which seems to indeed call sendError a bit too late (probably no one had suitable errors before). If your logs show nothing else you might want to modify the code by replacing "response.sendError" with "System.out.println" (or a suitable command to write information about the exception/error to the response) then recompile the servlet and and play with the status and health check pages a bit to generate more clues to the logs.

aharjula commented 10 years ago

Just to make sure by "maxima console" you mean the one that runs in the terminal/command line and not the xmaxima one that runs in a special x-window? Just got worried as I remembered that "Xmaxima: console" title and don't often hear the word "console"...

bennysalewski commented 10 years ago

With maxima console I mean the one that runs in the terminal. I've played a little bit with the health test and with the test console but the only error I've found in the log was:

Exception sending context destroyed event to listener of class websocket.drawboard.DrawboardContextListener java.lang.NoClassDefFoundError: javax/websocket/Endpoint

I've replaced "response.sendError" with "System.out.println".

aharjula commented 10 years ago

That websocket.drawboard thing is part of Tomcats examples and should not have anything to do with MaximaPool.

Did you check all the logs? Both the catalina.out and localhost.log (or however you have named it). There realy should be something there after the change to "System.out.println", you may even add "System.out.println('whatever');" to the start of the doGet() function to ensure that something gets written to the logs.

Which version of Java are you running? And that maxima is running with somewhat reasonable speed when called directly from stack without the pool?

bennysalewski commented 10 years ago

I've installed Java 7 on my server and I've tested maxima by entering commands in the console, but I'll test it with Moodle and STACK.

I've only looked in the localhost.log but I'll look also in the catalina.out. If I've made all tests, I will post the results.

bennysalewski commented 10 years ago

I've looked through the catalina.out and I've found a frequently appearing sequence of errors:

Exception in thread "MaximaPool-upkeep-starter-1" Exception in thread "MaximaPool-upkeep-starter-2" Exception in thread "MaximaPool-upkeep-starter-4" Exception$

java.lang.RuntimeException: Process timed out at fi.aalto.maximapool.MaximaProcess.waitForOutput(MaximaProcess.java:211) at fi.aalto.maximapool.MaximaProcess.(MaximaProcess.java:90) at fi.aalto.maximapool.MaximaPool.makeProcess(MaximaPool:154) at fi.aalto.maximapool.MaximaPool$1.run(MaximaPool.java:170)

aharjula commented 10 years ago

So basically the Maxima-process is not returning output to MaximaPool and the pool is just waiting. Surely you are sending commands that complete? Ending the line with suitable chars and so on?

Have you gotten that maxima working directly with stack? If it does not work there it probably won't work with the pool either.

bennysalewski commented 10 years ago

I've imported stack tasks in Moodle and added them to a Moodle test. But if I start the test, it appears an error:

qtype_stack_question : CAS error when instantiating the session: The CAS didn't provide evaluable expressions. Please check the connection to the CAS.

aharjula commented 10 years ago

Have you gone through all of the stack installation steps. Including the healtcheck script so that maxima gets initialised? Once you get /question/type/stack/healthcheck.php on that Moodle running with plots and all then we may assume that maxima actually works and there is hope for MaximaPool to try to run it.

bennysalewski commented 10 years ago

Ok, I've run the healthcheck script and the tests in Moodle works now but MaximaPool still not...

aharjula commented 10 years ago

When using MaximaPool with stack you'll wan't to set "maxima.load" to load the maximalocal.mac file so that maxima has a chance to evaluate stacks commands. You said that the "maxima.load = false" are you sure that there is nothing special around that "false" so that it does not load something strange. Also "maxima.ready.for.load" and "maxima.ready.for.use" assume that you load "maximalocal.mac" as those settings define strings that are being expected from the maxima process before continuing, and those default strings will probably never appear if you do not load it...

If you want to run with "maxima.load = false" you'll probably need to set "maxima.ready.for.use = (%i1)" assuming that you do not load anything to maxima through other means.

bennysalewski commented 10 years ago

I've set "maxima.ready.for.use = (%i1)" and now it works! But if I enter "ATAlgEquiv(x^2-1,(x-1)*(x+1));" in the test form I get "ATAlgEquiv(x - 1, (x - 1) (x + 1))" as response. But I should get "[true,true,"",""]"?

aharjula commented 10 years ago

ATAlgEquiv is part of the functions defined by stack... so for that you need to load maximalocal.mac or some subset of it defining those tests.

In any case, if anyone cares the problem was that MaximaPool was being run with a wrong configuration i.e. it was told to expect output X while no such output got generated. Case closed.