Search code examples
javaknime

KNIME batch mode execution hangs/never returns (started from Java process)


I'm executing a KNIME workflow in batch mode from Java.

The output seems to indicate success, but the process never returns (I have to use a timeout parameter to kill it).

Question: Does anyone have an idea why the process never returns?

Executing [C:\Program Files\KNIME\KNIME.exe, -noexit, -nosplash, -nosave, -reset, -application, org.knime.product.KNIME_BATCH_APPLICATION, -workflowFile="C:\...\workflow.knwf", -workflow.variable=template.sdf,C:\...\template.sdf,String, --launcher.suppressErrors]  [main] at AntBuildLogger.messageLogged()
KNIME.exe stdout: CompilerOracle: exclude javax/swing/text/GlyphView.getBreakSpot                            [Thread-2] at AntBuildLogger.messageLogged()
KNIME.exe stdout: INFO   main BatchExecutor  ===== Executing workflow C:\...\workflow.knwf =====  [Thread-2] at AntBuildLogger.messageLogged()
...
KNIME.exe stdout: INFO   main BatchExecutor  Workflow execution done Finished in 3 secs (3937ms)             [Thread-2] at AntBuildLogger.messageLogged()
KNIME.exe stdout: INFO   main BatchExecutor  ============= Workflow executed sucessfully ===============     [Thread-2] at AntBuildLogger.messageLogged()

I'm using Windows 10 and KNIME 3.2.1.

I'm using the Ant Exec task programmatically, so I'm pretty confident that all the in/out/err streams are handled correctly (also I'm using that code to invoke many other executables).


Solution

  • It is caused by the -noexit parameter (it is useful on Windows when manually started) as it prevents closing the process after finishing the execution.