Comments (9)
@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 ManagedProcessTest
:
@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.
from ch.vorburger.exec.
I've just deployed a 3.1.1 release with this fix to Maven central; it should be available from there shortly.
from ch.vorburger.exec.
Thanks for the fix. It works well.
from ch.vorburger.exec.
3.1.1 still hanging for me in this scenario.
import ch.vorburger.exec.ManagedProcess;
import ch.vorburger.exec.ManagedProcessBuilder;
public class Test {
public static void main(String[] args) throws Exception {
ManagedProcessBuilder mpb = new ManagedProcessBuilder("cmd-does-not-exist");
ManagedProcess p = mpb.build();
p.start();
}
}
Running "kill -3" against the hung process shows this culprit:
"Exec Default Executor" #19 prio=5 os_prio=0 tid=0x00007ff504464000 nid=0xb69a in Object.wait() [0x00007ff4de4fa000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000071ae65210> (a org.apache.commons.exec.ExecuteWatchdog)
at java.lang.Object.wait(Object.java:502)
at org.apache.commons.exec.ExecuteWatchdog.ensureStarted(ExecuteWatchdog.java:229)
at org.apache.commons.exec.ExecuteWatchdog.isWatching(ExecuteWatchdog.java:196)
- locked <0x000000071ae65210> (a org.apache.commons.exec.ExecuteWatchdog)
at ch.vorburger.exec.ManagedProcess.notifyProcessHalted(ManagedProcess.java:374)
at ch.vorburger.exec.LoggingExecuteResultHandler.onProcessFailed(LoggingExecuteResultHandler.java:57)
at ch.vorburger.exec.CompositeExecuteResultHandler.onProcessFailed(CompositeExecuteResultHandler.java:63)
at org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:205)
at java.lang.Thread.run(Thread.java:748)
from ch.vorburger.exec.
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.
from ch.vorburger.exec.
@gsylvie do you want to check if #96 from @cardamon might fix this problem?
from ch.vorburger.exec.
@mosesn do you have any interest to further dig into if this is still a bug that needs to be fixed?
from ch.vorburger.exec.
@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...
from ch.vorburger.exec.
It's probably worth first checking if #179 already fixes this by chance...
Looks like it does! I should definitely get #179 into #105, in that case...
from ch.vorburger.exec.
Related Issues (20)
- Release 3.1.4 HOT 4
- Concurrency Bug between isAlive() and exitValue() in ManagedProcess and/or in DefaultExecuteResultHandler HOT 2
- Do not log exception when failure (non-0) exit value is expected
- Java 8 instead of 11 HOT 10
- GitHub Build STUCK
- MultiCauseIOException fails on errorprone HOT 4
- Enforce Code Format with Checkstyle and/or Spotless and/or Google Java Format HOT 2
- Rename master branch to main HOT 1
- Replace JDT @Nullable annotation with JSpecify HOT 6
- 3.1.5 targets java 8 but calls a java 9 method HOT 8
- Partial output for Git command HOT 1
- Release 3.2.0 HOT 5
- Remove @SuppressWarnings("deprecation") used in commons-exec upgrade from 1.3 to 1.4.0
- 401 Sonatype Maven Central Release is broken due to: Content access is protected by token (401) HOT 5
- checkResult() should be optional HOT 2
- Performance issue HOT 2
- Unexpected error when calling waitForExit HOT 6
- CI is broken because Travis CI quota is insufficient HOT 2
- Is there a way to shutdown internal executor manually? HOT 1
- THREAD_SAFETY_VIOLATION (from Sonatype Lift) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ch.vorburger.exec.