ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46805] New: ant exec hangs when invoking "asadmin.bat start-domain"
Date Thu, 05 Mar 2009 19:07:59 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46805

           Summary: ant exec hangs when invoking "asadmin.bat
                    start-domain"
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: s.franke@bebbosoft.de


the following ANT code always hangs on Windows XP:

<target name="start">
  <echo message="asadmin start-domain" />
  <exec dir="." executable="${asadmin}">
  <arg value="start-domain"/>
  <arg value="${glassfish.domain}"/>
  </exec>
  <echo message="asadmin start-domain done" />
</target>


My workaround:

1. PumpStreamHandler.stop()

add a time out to the join() methods:

        try {
            outputThread.join(1000);
        } catch (InterruptedException e) {
            // ignore
        }
        try {
            errorThread.join(1000);
        } catch (InterruptedException e) {
            // ignore
        } 

2. Execute.java

a) fix the bogus method

    public static void closeStreams(Process process) {
        process.destroy(); // this is sufficient to cleanup all resources.
        /** WTF: never close streams maintained elsewhere!
        FileUtils.close(process.getInputStream());
        FileUtils.close(process.getOutputStream());
        FileUtils.close(process.getErrorStream());
        */
    }

b) reorder the invokations

    public int execute() throws IOException { 
...
//            streamHandler.stop(); 
            closeStreams(process); // FIRST DESTROY THE PROCESS
            streamHandler.stop();  // THEN STOP THREADS



... works for me, maybe for you too.

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

Mime
View raw message