Execution of R scripts very slow

Dear Knime Forum,

I have been using Knime and the R-Scripting Extension for quite some time. As I moved  Knime system to a Windows7 computer a strange behaviour occurs.

If I execute a script node which contains errors an error message occurs as expected:

ERROR     R Snippet     Execute failed: voidEval failed, request status: error code: 127

 

So far so good. However when I re-execute the node the execution does take a long time (up to some minutes). The debug output is the following:

DEBUG     ExecuteAction     Creating execution job for 1 node(s)...
DEBUG     NodeContainer     R Snippet 0:11 has new state: MARKEDFOREXEC
DEBUG     NodeContainer     R Snippet 0:11 has new state: QUEUED
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: EXECUTING
DEBUG     NodeContainer     Workflow Manager  has new state: EXECUTING
DEBUG     WorkflowManager     R Snippet 0:11 doBeforePreExecution
DEBUG     NodeContainer     R Snippet 0:11 has new state: PREEXECUTE
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: EXECUTING
DEBUG     WorkflowManager     R Snippet 0:11 doBeforeExecution
DEBUG     NodeContainer     R Snippet 0:11 has new state: EXECUTING
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: EXECUTING
DEBUG     LocalNodeExecutionJob     R Snippet 0:11 Start execute
DEBUG     WorkflowFileStoreHandlerRepository     Adding handler 5bf2b8d4-17f0-409c-9079-2eb4fb5972c7 (R Snippet 0:11: <no directory>) - 1 in total
DEBUG     R Snippet     reset
DEBUG     R Snippet     clean output ports.
ERROR     R Snippet     Execute failed: voidEval failed, request status: error code: 127
DEBUG     R Snippet     Execute failed: voidEval failed, request status: error code: 127
org.rosuda.REngine.Rserve.RserveException: voidEval failed, request status: error code: 127
    at org.rosuda.REngine.Rserve.RConnection.voidEval(RConnection.java:181)
    at de.mpicbg.tds.knime.scripting.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:52)
    at org.knime.core.node.NodeModel.execute(NodeModel.java:680)
    at org.knime.core.node.NodeModel.executeModel(NodeModel.java:536)
    at org.knime.core.node.Node.invokeNodeModelExecute(Node.java:995)
    at org.knime.core.node.Node.execute(Node.java:889)
    at org.knime.core.node.workflow.SingleNodeContainer.performExecuteNode(SingleNodeContainer.java:894)
    at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:100)
    at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:166)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:124)
    at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:239)
DEBUG     WorkflowManager     R Snippet 0:11 doBeforePostExecution
DEBUG     NodeContainer     R Snippet 0:11 has new state: POSTEXECUTE
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: EXECUTING
DEBUG     WorkflowManager     R Snippet 0:11 doAfterExecute - failure
DEBUG     R Snippet     reset
DEBUG     R Snippet     clean output ports.
DEBUG     WorkflowFileStoreHandlerRepository     Removing handler 5bf2b8d4-17f0-409c-9079-2eb4fb5972c7 (R Snippet 0:11: <no directory>) - 0 remaining
DEBUG     NodeContainer     R Snippet 0:11 has new state: IDLE
DEBUG     R Snippet     Configure succeeded. (R Snippet)
DEBUG     NodeContainer     R Snippet 0:11 has new state: CONFIGURED
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: CONFIGURED
DEBUG     NodeContainer     Workflow Manager  has new state: IDLE
DEBUG     NodeContainer     Peak-Offpeak 0 has new state: CONFIGURED

 

My system configuration is:

Windows7 (64bit)
R 2.15.1 (64bit)
Rserve 0.6-8 (64bit)
Eclipse 3.7
Knime  2.6.2

 

Has anybody encountered the same problem or knows a solution to this?

Best regards and thanks in advance

Johannes

Hi Johannes, it seems you are running KNIME from within Eclipse 3.7 which is currently not supported. This might explain the problem, but I am not sure why the node should then fail at a second run. My guess is that Rserve has a problem getting further requests from KNIME, restarting Rserve does not help?

Dear Gabriel,

I have tried to run an R-node with the Knime standalone (based on Eclipse 3.6) and the same behaviour occurs.

As you suggested I tried to restart Rserve when it hangs. For that I have to kill Rserve with the Task-Manager. When I do so Knime posts immediatly the answer that there is a common error message:

ERROR     R Snippet     Execute failed: voidEval failed, request status: error code: 127

So it seems that problem lies within Rserve. The only thing I can think about, what I did wrong is the configuration file of Rserve. At the moment this file is empty.

Is there any special configuration I have to apply to Rserve in order to get i working properly with Knime/R-Scripting extension?

Best regards

Johannes

Hi Johannes, I am not sure if this is really required, but this thread might help?

I have read the thread you pointed me too and tried to reconfigure Rserve. The mentioned configurations (remote=enable) did not bring any improvement. I tried also some other configuration which seemed meaningful. Unfortunatley I could not find a complete description/documentation of all parameters so I am not able to fully test all paremeter settings.

However I investigeted on the issue further by looking at the debug output of Rserve. When I execute a correct script I get the following last lines as output.

reply sent.
Connection closed by peer.
done.

 

When I execute a script with mistakes in the code I only get the following line:

reply sent.

So it seems to me that the connection is not closed properly when there is an error in the evaluation of the code. When I re-execute the script nothing happens. It looks like the old connection is still active. As there is only one connection possible on windows the system has to wait until the old connection is terminated which causes this slow execution times.

 

Might this be a problem in the R-Scripting-Nodes extension?

 

Best regards

Johannes