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 51917] New: Race condition in PumpStreamHandler causes incorrect output from exec
Date Thu, 29 Sep 2011 13:59:36 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51917

             Bug #: 51917
           Summary: Race condition in PumpStreamHandler causes incorrect
                    output from exec
           Product: Ant
           Version: 1.8.2
          Platform: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: petar.petrov@microfocus.com
    Classification: Unclassified


There is a race condition in PumpStreamHandler. To reproduce execute a process
using the ant API - the Execute class initialized with a LogStreamHandler
instance. Put breakpoints at the beginning of PumpStreamHandler.stop() and
LogOutputStream.processLine().

Make sure the process started with Execute.execute() outputs at least one line
in the standard output and exits. Once you start debugging, the debugger will
stop at both breakpoints - the process has exited and PumpStreamHandler.stop()
is called, while the thread which handles the output has also stopped at the
breakpoint in LogOutputStream.processLine(). At this point if you resume the
first thread, flush() will be called on the output stream - this will call
processLine(). Thus, two different threads will process the same line,
duplicating it in the output.

We are working on a build tool in Eclipse which start an Ant build script and
then parses the output. Because of this race condition we can't get a reliable
output of a spawned process.

Also this problem is not present in Ant 1.7.1.

-- 
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