DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21531>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21531

P4Change task intermittently fails

           Summary: P4Change task intermittently fails
           Product: Ant
           Version: 1.5.3
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Versions:
ant: apache-ant-1.5.3-1
p4 client: all versions

j2sdk:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.1-beta)
Java HotSpot(TM) Client VM (build Blackdown-1.4.1-beta, mixed mode)

os: Linux ojo 2.4.20-1-686 #1 Sat Mar 22 13:16:21 EST 2003 i686 GNU/Linux


Problem:
Running an ant build script with the <p4change /> task intermittently fails in
Linux, but seems to always work under Windows.


Detail:
The P4Change.getEmptyChangeList() method calls the execP4Command() method with
an anonymous P4HandlerAdapter(). The command runs the p4 client with "change -o"
arguments. Within the execP4Command(), a number of Threads are started.
Specifically, this occurs in the P4HandlerAdapter.start() method and these are
named "output" and "error" and correspond to the stdout and stderror streams
associated with the p4 system process. It turns out that the
streamHandler.start() method call within Execute.execute() will usually return
before the output and/or error Threads have terminated.

The result of this is that the P4Change.getEmptyChangeList() method will return
a partial Perforce change specification.

the execP4Command() method is once again called in
P4Change.getEmpytChangeList(), but this time with the "change -i" arguments. If
this process starts with a partical Perforce Change Specification, it will not
terminate and will simply hang.


Solution:
I was able to guarantee that the output and error thread would terminate by
adding the following in P4HandlerAdapter.start():

output.join();
error.join();

This solution, though it works, may not be ideal considering the overall
architecture of the Execute class.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to