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=18956>.
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=18956

p4change task causes build to hang

           Summary: p4change task causes build to hang
           Product: Ant
           Version: 1.5.3
          Platform: Sun
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Upgrading Ant 1.5 to 1.5.3 causes the perforce optional tasks to hang the build 
process, this is not always the case, maybe 2% of the builds succeed. If 
attaching a debugger and stepping through the perforce tasks, the build 
continues. Therefore it seems to me that is has to do with some timing 
problems. I've tried various versions of J2SE but the behavior stays the same.

However making thread dumps shows that it is always the Execute task that is in 
the wait state. It appears (by attaching truss to the perforce task) that the 
p4change -i command is waiting for input and Ant waiting for p4change -i to 
return. The is caused by a p4change -o command that is executed before (to 
obtain the form to fill in) that can't obtain the p4change -o output. Only with 
the debugger a form is obtained. Therefore it seems that the real problem is 
somewhere in the code that has to read the output from the Unix process.

I tried to run some old perforce optional tasks with Ant 1.5.3 that gave me the 
same behavior, so maybe it is somewhere in the core.

BTW the code in P4HandlerAdapter at line 135 seems strange to me, why 
synchronize on the Reader itself, shouldn't it be the outer class?

                while ((line = input.readLine()) != null) {
                    synchronized (this){ 
                        process(line);
                    }
                }
 
Full thread dump Java HotSpot(TM) Client VM (1.4.2-beta-b19 mixed mode):

"Thread-8" prio=5 tid=0x002769e8 nid=0x14 runnable [f0b81000..f0b819a0]
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:194)
        at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:
215)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
        - locked <0xf14903a8> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        - locked <0xf14903a8> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at org.apache.tools.ant.taskdefs.optional.perforce.P4HandlerAdapter$Read
er.run(P4HandlerAdapter.java:134)
        at java.lang.Thread.run(Thread.java:534)

"Thread-7" prio=5 tid=0x002767a0 nid=0x13 runnable [f1181000..f11819a0]
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:194)
        at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:
215)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
        - locked <0xf14819c0> (a java.io.BufferedInputStream)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
        - locked <0xf14846f8> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        - locked <0xf14846f8> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at org.apache.tools.ant.taskdefs.optional.perforce.P4HandlerAdapter$Read
er.run(P4HandlerAdapter.java:134)
        at java.lang.Thread.run(Thread.java:534)

"process reaper" daemon prio=5 tid=0x000a9c48 nid=0x12 runnable [f1381000..f1381
9a0]
        at java.lang.UNIXProcess.waitForProcessExit(Native Method)
        at java.lang.UNIXProcess.access$1000(UNIXProcess.java:17)
        at java.lang.UNIXProcess$3.run(UNIXProcess.java:80)

"Signal Dispatcher" daemon prio=10 tid=0x000c3360 nid=0x8 waiting on condition [
0..0]

"Finalizer" daemon prio=8 tid=0x000beb60 nid=0x6 in Object.wait() [fc381000..fc3
819a0]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1b43520> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
        - locked <0xf1b43520> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x000bd238 nid=0x5 in Object.wait() [fde8
1000..fde819a0]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1b43588> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:429)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
        - locked <0xf1b43588> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x0002d0f0 nid=0x1 in Object.wait() [ffbee000..ffbeecac]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf14810a8> (a java.lang.UNIXProcess)
        at java.lang.Object.wait(Object.java:429)
        at java.lang.UNIXProcess.waitFor(UNIXProcess.java:109)
        - locked <0xf14810a8> (a java.lang.UNIXProcess)
        at org.apache.tools.ant.taskdefs.Execute.waitFor(Execute.java:466)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:448)
        at org.apache.tools.ant.taskdefs.optional.perforce.P4Base.execP4Command(
P4Base.java:226)
        at org.apache.tools.ant.taskdefs.optional.perforce.P4Change.execute(P4Ch
ange.java:112)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

"VM Thread" prio=5 tid=0x000bc3d0 nid=0x4 runnable

"VM Periodic Task Thread" prio=10 tid=0x000c4e30 nid=0xa waiting on condition
"Suspend Checker Thread" prio=10 tid=0x000c0380 nid=0x7 runnable

Reply via email to