-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exec hangs when program not found #9
Comments
@shague your (and @trozet's ...) [1] looks about right, I guess. But there does indeed seem to be bug related to some sort of deadlock when starting a non existant executable - I can reproduce the "hang" with this in @Test(expected = ManagedProcessException.class)
public void startForMustFailForWrongExecutable() throws Exception {
ManagedProcess p = new ManagedProcessBuilder("someExec").build();
p.start();
} I'll debug this further when I have a minute, and fix it. |
I've just deployed a 3.1.1 release with this fix to Maven central; it should be available from there shortly. |
Thanks for the fix. It works well. |
3.1.1 still hanging for me in this scenario.
Running "kill -3" against the hung process shows this culprit:
|
Note: The main thread is terminating properly (and throwing the exception as expected). But seems a background thread is being created and never terminated - causing the "java" process on my system to hang. |
@mosesn do you have any interest to further dig into if this is still a bug that needs to be fixed? |
@gsylvie you are right. I can reproduce this easily in #188, using your example. However, the likely culprit appears to more something in https://commons.apache.org/proper/commons-exec/ than in this project? It's probably worth first checking if #179 already fixes this by chance... |
See vorburger/ch.vorburger.exec@exec-3.1.5...exec-3.2.0 for the "release notes" of what all this changes. The most important one is that this fixes vorburger/ch.vorburger.exec#9.
See vorburger/ch.vorburger.exec@exec-3.1.5...exec-3.2.0 for the "release notes" of what all this changes. The most important one is that this fixes vorburger/ch.vorburger.exec#9.
Michael,
with the exec package, it seems to hang when the program to run is not found.
Debugger shows that the IOexception was not caught and things kept moving forward and the code gets stuck at a wait() in ExecuteWatchdog:ensureStarted(), line 114. So the ManagedProcessExeception was never thrown.
Can you look at [1] to see if we are calling this correctly.
Thanks, Sam
[1] https://github.com/shague/opendaylight-ansible/blob/master/southbound/impl/src/main/java/org/opendaylight/ansible/southbound/AnsibleCommandServiceImpl.java#L82
[main] INFO ch.vorburger.exec.ManagedProcess - Starting Program [ansible-runner, -j, --hosts, localhost, -p, file, run, path] (in working directory /home/shague/git/ansible/southbound/impl/.)
[Exec Default Executor] ERROR ch.vorburger.exec.LoggingExecuteResultHandler - Program [ansible-runner, -j, --hosts, localhost, -p, file, run, path] (in working directory /home/shague/git/ansible/southbound/impl/.) failed unexpectedly
org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "ansible-runner" (in directory "."): error=2, No such file or directory)
at org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:205)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Cannot run program "ansible-runner" (in directory "."): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48)
at org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200)
... 1 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 7 more
The text was updated successfully, but these errors were encountered: