ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46305] New: Hung forked JVM when reading from standard input
Date Thu, 27 Nov 2008 06:55:36 GMT

           Summary: Hung forked JVM when reading from standard input
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks


When launching a Java program from ant with "fork=true", the launched program
seems to have *no* problem reading from the standard input (e.g. via, however this seems to stuff up the thread management of the
launched program (i.e. the forked/child JVM) and possibly also crashes the
child JVM.

To reproduce this on a Windows XP (with Service Pack 3) using Sun JDK 6 update
10, I wrote a class with a main method that simply contains:
      try {
         System.out.println("X[Return] to quit");
         while ( != 'X')

         // see shutdown hook for subsequent shutdown operations
      } catch (IOException e) {

When the program runs and blocks/waits for input from the user, if attached via
JMX using JVisualVM (a tool that comes with Sun JDK 6 installation, for viewing
the memory and thread state of a VM), JVisualVM will freeze and could not
return any info about the JVM. The main thread of the JVM itself still works
since still responds to user input, but the other threads of
the program's JVM seem to have died and therefore the program/JVM cannot be
connected via RMI, remote debugging, using -QUIT signal to get JVM thread dump,

The above is just a straightforward way to demostrate the problem, but in
practice, without using JMX, the problem can also be reproduced using certain
combinations of operations involving "complex" thread management, such as AWT
event handling, RMI connection, etc. As such, it looks like that the problem is
caused by a combination of the following factors: 
1. Launching a program from ant using "fork=true"
2. The program blocks to receive input from user, e.g.
3. The program performs "complex" threading operation, such as exporting RMI
remote objects, displaying a java.awt.Frame, connecting to the VM via JMX etc.

The JVM hang problem is noticeable/reproducable:
- On Windows XP (Service Pack 3, not sure about other service packs), but *no*
problem on Linux and Windows Vista.
- Using Sun JDK 1.4.2_14, 1.5.0_12, 1.6.0_10, and IBM J9 2.3
- Ant 1.7.0 and 1.7.1

I have no idea what could cause this problem, but I suspect that I/O
redirection is not properly implemented in Windows XP, and thus crashing the
JVM (e.g. interfering with the JVM's thread management).



Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message