https://issues.apache.org/bugzilla/show_bug.cgi?id=50229
Summary: Slow down in StreamPumper
Product: Ant
Version: 1.8.1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: [email protected]
ReportedBy: [email protected]
Upgrading from ant 1.7.1 to ant 1.8.1 resulted in build times doubling (2hrs vs
1hr). Most of the time increase seems to be related to lines similar to the
following:
<java classname="com.MyClass" fork="true" failonerror="true"
input="${destdir}/inputFile.zip"
output="${destdir}/outputFile.zip">
<classpath refid="my.classpath"/>
<arg value="AppSrv"/>
</java>
I put together a simple test that uses exec and cat to copy a 38MB file and
times went from 6sec to 9min when the version of ant changed. My guess is that
this is being caused by changes to StreamPumper.
----------------------------------------------
Buildfile: build.xml
init:
[echo] Start Time: Sun, Nov 7, 2010 - 12:00:05 EST
[echo] Ant version: Apache Ant version 1.7.1 compiled on June 27 2008
[echo] Java version: 1.5.0_22-b03
[echo] OS Name: Windows XP
[echo]
all:
BUILD SUCCESSFUL
Total time: 6 seconds
----------------------------------------------
Buildfile: S:\ant\test\build.xml
init:
[echo] Start Time: Sun, Nov 7, 2010 - 12:05:19 EST
[echo] Ant version: Apache Ant version 1.8.2alpha compiled on October 27
2010
[echo] Java version: 1.5.0_22-b03
[echo] OS Name: Windows XP
[echo]
all:
BUILD SUCCESSFUL
Total time: 9 minutes 10 seconds
----------------------------------------------
<project name="test" default="all" basedir=".">
<target name="init">
<tstamp>
<format property="start_time" pattern="E, MMM d, yyyy - HH:mm:ss z"
locale="en" />
</tstamp>
<echo>Start Time: ${start_time}</echo>
<echo>Ant version: ${ant.version}</echo>
<echo>Java version: ${java.vm.version}</echo>
<echo>OS Name: ${os.name}</echo>
<echo message="" />
<!-- 38MB file -->
<property name="largefile" location="large_file.zip" />
<property name="outfile" location="copy.zip" />
</target>
<target name="all" depends="init">
<exec executable="cat" input="${largefile}" output="${outfile}"/>
</target>
<target name="clean" depends="init">
<delete file="${outfile}"/>
</target>
</project>
----------------------------------------------
Suspected changes:
src\main\org\apache\tools\ant\taskdefs\StreamPumper.java
Ant 1.7.1
while ((length = is.read(buf)) > 0 && !finish) {
os.write(buf, 0, length);
if (autoflush) {
os.flush();
}
}
Ant 1.8.2
while (true) {
waitForInput(is);
if (finish || Thread.interrupted()) {
break;
}
length = is.read(buf);
if (length <= 0 || finish || Thread.interrupted()) {
break;
}
os.write(buf, 0, length);
if (autoflush) {
os.flush();
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.