When executing two deployments where the second deployment was made shortly after the first one, the second is failing with the following fatal error, “Fatal Error: LIMIT_EXCEEDED: Try deploying again. Your deployment exceeded its maximum retry limit. If you keep seeing this error, please contact Salesforce Customer Support.”
Expected Results
The second deployment succeeds.
Actual Results
The second deployment fails.
REPRODUCER:
1) Login in the org
2) Create the following Apex test class.
public class Test {
@isTest
public static void test1() {
String dummyString = '';
Integer max = 100000;
for (Integer i = 0; i < max; i++) {
Integer rand = Math.round(Math.random() * 1000);
dummyString = dummyString + String.valueOf(rand);
}
}
@isTest
public static void test2() {
String dummyString = '';
Integer max = 100000;
for (Integer i = 0; i < max; i++) {
Integer rand = Math.round(Math.random() * 1000);
dummyString = dummyString + String.valueOf(rand);
}
}
3) Download the zip files that'll be used for the testing.
4) Go to workbench, deploy using the zip file, choose test level as RunAllTestInOrg, leave everything else as default. Click Next and click Deploy.
5) Repeat step 5 immediately.
6) The second deployment should fail with the error.
Space out the deployments.
The second deployment shouldn't be dequeued until the first deployment has finished. It doesn't make sense to dequeue it if another deployment is executing because it won't be able to get the lock. Retry the deployment after failing to acquire the lock.
000381180

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.