ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 54128] New: Ant 1.8 exec task changes have slowed exec to a crawl
Date Fri, 09 Nov 2012 20:26:11 GMT

          Priority: P2
            Bug ID: 54128
           Summary: Ant 1.8 exec task changes have slowed exec to a crawl
          Severity: regression
    Classification: Unclassified
          Hardware: PC
            Status: NEW
           Version: 1.8.4
         Component: Core tasks
           Product: Ant

Created attachment 29578
Restores the exec task speed to ant 1.7 times

Changes made between ant 1.7 and ant 1.8 slowed the exec task to a crawl.

The reason is that it changed blocking I/O to to polled I/O with a period of
100 ms.  In effect any task that completes inside of the 100 ms window will
have to wait for the sleep(100) call to finish at which point the non-blocking
read call realizes it has exhausted all data and actually exits.

The correct approach is to go back to blocking reads but upon detection of
process termination follow a few simple steps:

1. Use non-blocking available() call on the input ends of the subprocess's
stdout,stderr streams and spin w/ 100 ms sleep until no bytes are available. 
You can be certain this will exhaust all output because it runs after it is
known that the subprocess has already exited.
2. Call destroy() on the process object.  This closes the input streams which
has the effect of unblocking the blocked read calls.
3. Continue with the rest of the original code which is to stop the stream
handler which joins the reading threads.  Because the read calls have been
unblocked and exhausted all input the join will complete immediately in all

This has been tested on OS X 10.8 Mountain Lion and it restores the exec task
speed back to ant 1.7 series levels (i.e. 20 seconds to run our exec-heavy
build task instead of 2-3 minutes).

It will obviously require testing on the Windows platform where the original
Bug 5003 was reported to verify it didn't regress that bug fix.

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

View raw message