ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Doyle <jdo...@iso-ne.com>
Subject Ant 1.6.5 <java>/<input> causes missed console input
Date Tue, 27 Sep 2005 15:37:14 GMT
Hi,

I am regression testing our build, which currently runs under Ant 1.6.2, 
under the latest version, Ant 1.6.5, and found a situation that required 
changing our buildfiles to work around a behavior of Ant 1.6.5.

It looks like the Ant 1.6.5 <java> task now uses the input stream from 
the console and attempts to read from it.  This blocks a subsequent 
<input> task from successfully reading from that input stream.  When the 
<input> task runs, the user has to enter a first line of text that gets 
absorbed by a thread left around by the <java> task, and then only the 
second line of text causes the <input> task to continue and gets used as 
the user's input.

Below is a simple buildfile and some output from Ant 1.6.2 and Ant 1.6.5 
showing the behavior.

We worked around this issue by adding an inputstring="" attribute to our 
<java> tasks, to force <java> to ignore the input stream from the console. 

It seems like this issue is an Ant bug, is it being addressed for the 
next Ant release?  It would be good if you did not have to set an 
inputstring attribute simply to get <java> to not tie up console input.

Thanks,
Jim

Buildfile:
---------------------------------------------------
<project name="test" basedir="." default="inputs">
<target name="inputs">
<echo message="Ant version: ${ant.version}"/>
<java fork="true" classpath="${java.class.path}" 
classname="com.sun.tools.javac.Main"/>
<input message="Enter property" addproperty="property"/>
<echo message="You entered ${property}"/>
</target>
</project>
---------------------------------------------------

Ant 1.6.2 run:
---------------------------------------------------
[jdoyle@jdoyle test-input]$ ant
Buildfile: build.xml

inputs:
     [echo] Ant version: Apache Ant version 1.6.2 compiled on July 16 2004
     [java] Usage: javac <options> <source files>
     [java] where possible options include:
     [java]   -g                        Generate all debugging info
     [java]   -g:none                   Generate no debugging info
     [java]   -g:{lines,vars,source}    Generate only some debugging info
     [java]   -O                        Optimize; may hinder debugging 
or enlarge class file
     [java]   -nowarn                   Generate no warnings
     [java]   -verbose                  Output messages about what the 
compiler is doing
     [java]   -deprecation              Output source locations where 
deprecated APIs are used
     [java]   -classpath <path>         Specify where to find user class 
files
     [java]   -sourcepath <path>        Specify where to find input 
source files
     [java]   -bootclasspath <path>     Override location of bootstrap 
class files
     [java]   -extdirs <dirs>           Override location of installed 
extensions
     [java]   -d <directory>            Specify where to place generated 
class files
     [java]   -encoding <encoding>      Specify character encoding used 
by source files
     [java]   -target <release>         Generate class files for 
specific VM version

     [java] Java Result: 2
    [input] Enter property
foo
     [echo] You entered foo

BUILD SUCCESSFUL
Total time: 2 seconds
---------------------------------------------------

Ant 1.6.5 run:
---------------------------------------------------
[jdoyle@jdoyle test-input]$ /usr/local/apache-ant-1.6.5/bin/ant
Buildfile: build.xml

inputs:
     [echo] Ant version: Apache Ant version 1.6.5 compiled on June 2 2005
     [java] Usage: javac <options> <source files>
     [java] where possible options include:
     [java]   -g                        Generate all debugging info
     [java]   -g:none                   Generate no debugging info
     [java]   -g:{lines,vars,source}    Generate only some debugging info
     [java]   -O                        Optimize; may hinder debugging 
or enlarge class file
     [java]   -nowarn                   Generate no warnings
     [java]   -verbose                  Output messages about what the 
compiler is doing
     [java]   -deprecation              Output source locations where 
deprecated APIs are used
     [java]   -classpath <path>         Specify where to find user class 
files
     [java]   -sourcepath <path>        Specify where to find input 
source files
     [java]   -bootclasspath <path>     Override location of bootstrap 
class files
     [java]   -extdirs <dirs>           Override location of installed 
extensions
     [java]   -d <directory>            Specify where to place generated 
class files
     [java]   -encoding <encoding>      Specify character encoding used 
by source files
     [java]   -target <release>         Generate class files for 
specific VM version

     [java] Java Result: 2
    [input] Enter property
foo
bar
     [echo] You entered bar

BUILD SUCCESSFUL
Total time: 3 seconds
---------------------------------------------------

Ant 1.6.5 run with "kill -QUIT" thread dumps showing thread holding up 
console input stream:
---------------------------------------------------
[jdoyle@jdoyle test-input]$ /usr/local/apache-ant-1.6.5/bin/ant
Buildfile: build.xml

inputs:
     [echo] Ant version: Apache Ant version 1.6.5 compiled on June 2 2005
     [java] Usage: javac <options> <source files>
     [java] where possible options include:
     [java]   -g                        Generate all debugging info
     [java]   -g:none                   Generate no debugging info
     [java]   -g:{lines,vars,source}    Generate only some debugging info
     [java]   -O                        Optimize; may hinder debugging 
or enlarge class file
     [java]   -nowarn                   Generate no warnings
     [java]   -verbose                  Output messages about what the 
compiler is doing
     [java]   -deprecation              Output source locations where 
deprecated APIs are used
     [java]   -classpath <path>         Specify where to find user class 
files
     [java]   -sourcepath <path>        Specify where to find input 
source files
     [java]   -bootclasspath <path>     Override location of bootstrap 
class files
     [java]   -extdirs <dirs>           Override location of installed 
extensions
     [java]   -d <directory>            Specify where to place generated 
class files
     [java]   -encoding <encoding>      Specify character encoding used 
by source files
     [java]   -target <release>         Generate class files for 
specific VM version

     [java] Java Result: 2
    [input] Enter property
Full thread dump:

"Thread-2" daemon prio=1 tid=0xef841878 nid=0x70bc runnable 
[0xeb778000..0xeb7791e4]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:178)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:181)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:275)
    at java.io.FilterInputStream.read(FilterInputStream.java:109)
    at java.io.FilterInputStream.read(FilterInputStream.java:88)
    at org.apache.tools.ant.taskdefs.StreamPumper.run(StreamPumper.java:90)
    at java.lang.Thread.run(Thread.java:479)

"process forker" daemon prio=1 tid=0xef83c268 nid=0x70bc waiting on 
monitor [0xee97d000..0xee97e1e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.UNIXProcessForker.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

"process reaper" daemon prio=1 tid=0xef83be40 nid=0x70bc runnable 
[0xef37f000..0xef37f1e4]
    at java.lang.UNIXProcessReaper.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

"Signal Dispatcher" daemon prio=1 tid=0x80942d8 nid=0x70bc waiting on 
monitor [0..0]

"Finalizer" daemon prio=1 tid=0x808e2c8 nid=0x70bc waiting on monitor 
[0x5df5000..0x5df51e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:103)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:157)

"Reference Handler" daemon prio=1 tid=0x808c7a8 nid=0x70bc waiting on 
monitor [0x4f09000..0x4f091e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:415)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:105)

"main" prio=1 tid=0x804e898 nid=0x70bc waiting for monitor entry 
[0xfeffc000..0xfeffd4b4]
    at java.io.BufferedInputStream.read(BufferedInputStream.java:268)
    at org.apache.tools.ant.Project.defaultInput(Project.java:1111)
    at org.apache.tools.ant.Task.handleInput(Task.java:305)
    at 
org.apache.tools.ant.UnknownElement.handleInput(UnknownElement.java:216)
    at org.apache.tools.ant.Project.demuxInput(Project.java:1135)
    at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:48)
    at java.io.FilterInputStream.read(FilterInputStream.java:64)
    at java.io.DataInputStream.readLine(DataInputStream.java:444)
    at 
org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:56)
    at org.apache.tools.ant.taskdefs.Input.execute(Input.java:117)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

"VM Thread" prio=1 tid=0x808b5e8 nid=0x70bc runnable

"VM Periodic Task Thread" prio=1 tid=0x8092fb0 nid=0x70bc waiting on 
monitor
"Suspend Checker Thread" prio=1 tid=0x8093890 nid=0x70bc runnable
foo
Full thread dump:

"process forker" daemon prio=1 tid=0xef83c268 nid=0x70bc waiting on 
monitor [0xee97d000..0xee97e1e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.UNIXProcessForker.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

"process reaper" daemon prio=1 tid=0xef83be40 nid=0x70bc runnable 
[0xef37f000..0xef37f1e4]
    at java.lang.UNIXProcessReaper.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

"Signal Dispatcher" daemon prio=1 tid=0x80942d8 nid=0x70bc waiting on 
monitor [0..0]

"Finalizer" daemon prio=1 tid=0x808e2c8 nid=0x70bc waiting on monitor 
[0x5df5000..0x5df51e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:103)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:157)

"Reference Handler" daemon prio=1 tid=0x808c7a8 nid=0x70bc waiting on 
monitor [0x4f09000..0x4f091e4]
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:415)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:105)

"main" prio=1 tid=0x804e898 nid=0x70bc runnable [0xfeffc000..0xfeffd4b4]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:178)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:181)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:275)
    at org.apache.tools.ant.Project.defaultInput(Project.java:1111)
    at org.apache.tools.ant.Task.handleInput(Task.java:305)
    at 
org.apache.tools.ant.UnknownElement.handleInput(UnknownElement.java:216)
    at org.apache.tools.ant.Project.demuxInput(Project.java:1135)
    at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:48)
    at java.io.FilterInputStream.read(FilterInputStream.java:64)
    at java.io.DataInputStream.readLine(DataInputStream.java:444)
    at 
org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:56)
    at org.apache.tools.ant.taskdefs.Input.execute(Input.java:117)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

"VM Thread" prio=1 tid=0x808b5e8 nid=0x70bc runnable

"VM Periodic Task Thread" prio=1 tid=0x8092fb0 nid=0x70bc waiting on 
monitor
"Suspend Checker Thread" prio=1 tid=0x8093890 nid=0x70bc runnable
bar
     [echo] You entered bar

BUILD SUCCESSFUL
Total time: 10 seconds
---------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message