You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/06/22 15:25:55 UTC

DO NOT REPLY [Bug 49490] New: Killed Ant process leaves forked java sub-processes

https://issues.apache.org/bugzilla/show_bug.cgi?id=49490

           Summary: Killed Ant process leaves forked java sub-processes
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: uldisk@ctco.lv


I already red a lot of similar issues but still don`t see a working fix or
workaround.

For example, this is my code:

<java classname="com.google.gwt.dev.Compiler" fork="true"
maxmemory="${config.gwt.javac.maxmemory}" dir="${basedir}" failonerror="true" 
                    resultproperty="gwt.compile.error.code"
jvmargs="${config.gwt.javac.jvmargs}">
                <arg line="-style ${config.gwt.style}" />
                <arg line="-war ${work.web.gwt.web.main.gwt-generated.dir}" />
                <arg line="${config.gwt.validateOnly}" />
                <arg value="${gwt-class}" />
                <classpath refid="gwt.libs.snapshot.classpath" />
                <classpath refid="gwt.libs.classpath" />
                <classpath path="${src.main.dir}" />
            </java>

If I run my build, wait for GWT compilation to start and then press ctrl-c
(kill), Ant process exits but GWT compilation is still running. GWT compilation
like other tasks may take a lot of time and if I press ctrl-c that means I want
to abort whole build.

As understand this is related to shutdownhooks in Java. I see kind of their
implementation in ProcessDestroyer class which is used in Execute class which
is used from <java/> task, but seems it still is not working or doing something
else.

I know this must be possible couse I already had implemented something similar
in my tool which starts up Ant process. If I kill my tool, Ant process gets
killed too. Should I give a try?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49490] Killed Ant process leaves forked java sub-processes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49490

--- Comment #2 from Uldis Karlovs-Karlovskis <ul...@ctco.lv> 2010-06-28 08:34:14 EDT ---
I can`t access these hudson sources.
However, killing direct subprocesses should be enough for start.

(In reply to comment #1)
> Due to limitations in the Java APIs for process control, a general fix may not
> be possible without native code, such as in:
> 
> https://hudson.dev.java.net/svn/hudson/trunk/hudson/main/core/src/main/java/hudson/util/ProcessTree.java
> 
> A shutdown hook in Ant would likely make it possible to kill off direct
> subprocesses, but not subsubprocesses.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49490] Killed Ant process leaves forked java sub-processes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49490

Uldis Karlovs-Karlovskis <ul...@ctco.lv> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Uldis Karlovs-Karlovskis <ul...@ctco.lv> 2010-06-29 04:54:52 EDT ---
Checked out sources and finally understood where is my problem. Ant itself has
all needed shutdownhooks and they work as expected. Since I`m using special
tool which starts Ant, I run into problem with uncontrolled Java
sub-sub-processes. There are few complicated options how to resolve my problem,
but that`s not just worth of it :( going to wait for fix in Java.

Related articles:
http://bugs.sun.com/view_bug.do?bug_id=4244896
http://bugs.sun.com/view_bug.do?bug_id=4770092
http://www.rgagnon.com/javadetails/java-0467.html

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49490] Killed Ant process leaves forked java sub-processes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49490

Jesse Glick <jg...@netbeans.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jglick@netbeans.org

--- Comment #1 from Jesse Glick <jg...@netbeans.org> 2010-06-22 12:46:29 EDT ---
Due to limitations in the Java APIs for process control, a general fix may not
be possible without native code, such as in:

https://hudson.dev.java.net/svn/hudson/trunk/hudson/main/core/src/main/java/hudson/util/ProcessTree.java

A shutdown hook in Ant would likely make it possible to kill off direct
subprocesses, but not subsubprocesses.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.