Coder Social home page Coder Social logo

Comments (9)

vorburger avatar vorburger commented on September 24, 2024

@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.

vorburger avatar vorburger commented on September 24, 2024

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.

shague avatar shague commented on September 24, 2024

Thanks for the fix. It works well.

from ch.vorburger.exec.

gsylvie avatar gsylvie commented on September 24, 2024

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.

gsylvie avatar gsylvie commented on September 24, 2024

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.

vorburger avatar vorburger commented on September 24, 2024

@gsylvie do you want to check if #96 from @cardamon might fix this problem?

from ch.vorburger.exec.

vorburger avatar vorburger commented on September 24, 2024

@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.

vorburger avatar vorburger commented on September 24, 2024

@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.

vorburger avatar vorburger commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.