Skip to content

Let max retries exit the CA processing step instead of retryAfter#6587

Open
ignoramous wants to merge 2 commits intoacmesh-official:devfrom
ignoramous:patch-1
Open

Let max retries exit the CA processing step instead of retryAfter#6587
ignoramous wants to merge 2 commits intoacmesh-official:devfrom
ignoramous:patch-1

Conversation

@ignoramous
Copy link

MAX_REQUEST_RETRY_TIMES controls no. of retries acme.sh
will perform when the CA is processing issue requests. Instead of
short-circuiting the entire operation when retryAfter is set to
more than 10m (600 seconds), wait for a maximum of 10m and
issue a retry. Some CAs, like ZeroSSL, set very high retryAfter.
@ignoramous
Copy link
Author

Emitting _err from a few relevant places so GitHub's built-in Copliot will help catch the issue (--debug 2 generates a LOT of logs and options like Copilot help reduce time it takes to parse them).

Even after these changes, a few places with return 1 emit logs as _info or _debug or not emitted at all (should be probably changed to _err).

@neilpang
Copy link
Member

neilpang commented Nov 9, 2025

if the retryafter is too large, it usually means the ca is refusing your requests. so we should give up.
Maybe 600 is not that large to give up. how about make it 3600?

@ignoramous
Copy link
Author

if the retryafter is too large, it usually means the ca is refusing your requests ... Maybe 600 is not that large to give up. how about make it 3600?

What I've found with ZeroSSL is, when there are 8+ domains in a single cert request, it takes a while (I've seen it take 10mins). But their retrtAfter is set to 84600 (1 day), which is over-the-top, as the response is usually available within 10mins.

Copilot AI review requested due to automatic review settings December 22, 2025 20:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the retry behavior when the CA server's retry-after value exceeds 600 seconds. Instead of exiting the CA processing step immediately, the code now sleeps for 600 seconds and continues the retry loop, allowing the process to complete more reliably.

  • Changed retry-after timeout handling to sleep for 600 seconds instead of exiting immediately
  • Upgraded informational messages to error messages for better visibility of retry exhaustion scenarios
  • Enhanced error message clarity by including the file path in the domain key error

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5197 to +5198
_info "The retryafter=$_retryafter value is too large (> 600); sleeping for 600 seconds."
_sleep 600
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry-after handling is now inconsistent between the two locations. At line 2318 in _send_signed_request(), when retry-after exceeds 600, the code logs an error and exits the retry loop. However, at line 5197 in the CA processing step, when retry-after exceeds 600, the code sleeps for 600 seconds and continues retrying. This inconsistency could lead to confusion about the expected behavior. Consider aligning these two behaviors or documenting why they should differ.

Suggested change
_info "The retryafter=$_retryafter value is too large (> 600); sleeping for 600 seconds."
_sleep 600
_err "$d: Retry-After value ($_retryafter) is too large (> 600); aborting verification."
_clearupwebbroot "$_currentRoot" "$removelevel" "$token"
_clearup
_on_issue_err "$_post_hook" "$vlist"
return 1

Copilot uses AI. Check for mistakes.
_clearup
_on_issue_err "$_post_hook" "$vlist"
return 1
_info "The retryafter=$_retryafter value is too large (> 600); sleeping for 600 seconds."
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses a semicolon delimiter while the similar error message at line 2318 uses a comma. For consistency across error messages, consider using the same delimiter in both places.

Suggested change
_info "The retryafter=$_retryafter value is too large (> 600); sleeping for 600 seconds."
_info "The retryafter=$_retryafter value is too large (> 600), sleeping for 600 seconds."

Copilot uses AI. Check for mistakes.
continue
else
_info "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
_err "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After logging the error, the code should break out of the loop or return to exit the retry logic. Currently, execution falls through to line 2321 and continues processing other error conditions, which is inconsistent with the error message "will not retry anymore." Consider adding a break or return statement after this error message.

Suggested change
_err "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
_err "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
break

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants