commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Carissimo" <d...@us.ibm.com>
Subject [EXEC] Issue with Apache Commons Exec
Date Tue, 06 Jun 2017 14:27:21 GMT


Hi,
I'm new to using Apache Commons Exec Version 1.3 and I've got a strange one
that I can't seem to figure out.  I'm getting the following stack trace
when I run :

org.apache.commons.exec.ExecuteException: The stop timeout of 300000 ms was
exceeded (Exit value: -559038737)
org.apache.commons.exec.ExecuteException: The stop timeout of 300000 ms was
exceeded (Exit value: -559038737)
	at org.apache.commons.exec.PumpStreamHandler.stopThread
(PumpStreamHandler.java:295)
	at org.apache.commons.exec.PumpStreamHandler.stop
(PumpStreamHandler.java:181)
	at org.apache.commons.exec.DefaultExecutor.executeInternal
(DefaultExecutor.java:381)
	at org.apache.commons.exec.DefaultExecutor.execute
(DefaultExecutor.java:166)
	at com.ibm.bmfuncsec.keymgmt.server.ExecuteCmd.execute
(ExecuteCmd.java:123)
	at com.ibm.bmfuncsec.keymgmt.server.server$WorkerThread.run
(server.java:285)

When I look at the source for DefaultExecutor and PumpStreamHandler, it
appears to me that the external command that I've tried to run has
completed, and the commons exec code is trying to shutdown the threads that
capture stdout and stderr.  According to the timestamps, the exception is
created about 10 minutes after the external command has completed, but I've
set a timeout of 5 minutes ...

Here's what my source looks like :

    CommandLine cmdLine = CommandLine.parse("/bin/bash " + cmd);

    stdout = new ByteArrayOutputStream();
    stderr = new ByteArrayOutputStream();
    PumpStreamHandler psh = new PumpStreamHandler(stdout, stderr);

    psh.setStopTimeout(TIMEOUT_FIVE_MINUTES);

    ExecuteWatchdog watchdog = new ExecuteWatchdog
(TIMEOUT_TEN_MINUTES);   // timeout in milliseconds

    Executor executor = new DefaultExecutor();
    executor.setExitValue(0);
    executor.setStreamHandler(psh);
    executor.setWatchdog(watchdog);

    exitValue = executor.execute(cmdLine, env);


    private long    TIMEOUT_ONE_SECOND      = 1000;
    private long    TIMEOUT_TEN_SECONDS     = 10 * TIMEOUT_ONE_SECOND;
    private long    TIMEOUT_ONE_MINUTE      = 60 * TIMEOUT_ONE_SECOND;
    private long    TIMEOUT_FIVE_MINUTES    = 5  * TIMEOUT_ONE_MINUTE;
    private long    TIMEOUT_TEN_MINUTES     = 10 * TIMEOUT_ONE_MINUTE;

Can someone have a look at the above and let me know what the problem might
be and how do I fix it??

Thanks!!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message