You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/09/29 15:59:36 UTC

DO NOT REPLY [Bug 51917] New: Race condition in PumpStreamHandler causes incorrect output from exec

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.

DO NOT REPLY [Bug 51917] Race condition in PumpStreamHandler causes incorrect output from exec

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51917

Petar Petrov <pe...@microfocus.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.petrov@microfocus.com
         OS/Version|                            |All

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 51917] Race condition in PumpStreamHandler causes incorrect output from exec

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51917

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2011-12-06 16:50:24 UTC ---
since svn revision 1095736 flush() no longer calls processLine in order
to fix bug 50507

This should also fix the race condition you describe.  Can you please confirm
trunk works for you?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.