Hi@robinshen
Recently we have some error build when using parrallel steps.
Here is the log that I found on server:
Error notifying task node of job finishing (job class: $job_class, job id: com.pmease.quickbuild.resource.ResourceAllocateJob, task node: $qbagent_name:$qbagent_port)
com.pmease.quickbuild.RemotingException: Java heap space
We use the above config in our agent:
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=1024
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=8192
Because of our privacy policy, I cannot share the actual content of step. But I think you can reproduce the error like above.
- Create a java program to simulate java.lang.OutOfMemoryError in Java
import java.util.Vector;
public class MemoryEater
{
public static void main(String[] args)
{
Vector v = new Vector();
long endTime = System.currentTimeMillis() + 10000;
while (System.currentTimeMillis() <endTime)
{
byte b[] = new byte[14856];
v.add(b);
Runtime rt = Runtime.getRuntime();
System.out.println( "free memory: " + rt.freeMemory() );
}
}
}
- run script to make 200 java program like in step 1
#!/bin/bash
last=200
for i in $(seq 1 $last);
do
cp MemoryEater.java MemoryEater$i.java
sed -i "s/MemoryEater/MemoryEater$i/g" MemoryEater$i.java
javac MemoryEater$i.java
done
- Run the 200 parrallel steps with 200 file abve with command:
java -Xmx2048m MemoryEater${params.get("NUMBER")}
The config in repeat parameters:
Parameter Name : NUMBER
Parameter Values:
groovy:
def List numbers=[]
for(int i in 1..200) numbers.add(i.toString())
return numbers
- Run the build with max i in different cases (200/145/140/100) and the result is different.
The suspicious thing is when running in parallel with under 145 files the build can success and when increase the number build start failing.
Can you try to figure out why the agent only can run this specific numbers?
We change the Parallel step to Sequential step, the issue is resolve but the time to run it is terrible slow compare with Parallel step.
I change the config wrapper.java.maxmemory=8192MB to 12GB. But it is pass the build randomly so we donot think this is greate solution.