Skip to content

Fix #182 configurable transient errors - #335

Open
Usein Mambediiev (usemam) wants to merge 3 commits into
microsoft:mainfrom
usemam:fix/182-configurable-transient-errors
Open

Usein Mambediiev (usemam) wants to merge 3 commits into
microsoft:mainfrom
usemam:fix/182-configurable-transient-errors

Conversation

@usemam

@usemam Usein Mambediiev (usemam) commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #182

Summary

Adds a transientErrorNumbers setting that lists extra SQL error numbers to retry as transient, on top of the built-in list. This helps with errors that only happen transiently in a particular environment.

Changes

  • SqlOrchestrationServiceSettings.TransientErrorNumbers (IReadOnlyCollection<int>?, default null).
  • SqlUtils.IsTransient checks the configured numbers after the built-in list. Matching errors are retried with the existing policy.
  • Azure Functions: transientErrorNumbers is read from host.json via SqlDurabilityOptions.
  • Docs: docs/quickstart.md describes the new setting and lists the built-in transient error numbers.

try
{
await SqlUtils.ExecuteNonQueryAsync(command, this.traceHelper, instance.InstanceId);
await SqlUtils.ExecuteNonQueryAsync(command, this.traceHelper, this.settings.TransientErrorNumbers, instance.InstanceId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still won't retry the error reported in #182: GetAndOpenConnectionAsync() calls OpenAsync() before this helper is reached, so a login/network failure such as 47073 escapes before the configured number is classified. Could the retry cover connection opening as well as command execution?

LogHelper traceHelper,
IReadOnlyCollection<int>? transientErrorNumbers,
string? instanceId,
int maxRetries = 5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The existing five retries back off for only about 10 seconds total (plus jitter), while the outage described in #182 lasts 3–5 minutes. With this fixed retry window, configuring 47073 still leaves most of that outage uncovered. Could the retry duration/policy accommodate that scenario, or should the setting also expose a configurable retry window?

}

// User-configured error numbers that should also be treated as transient
if (additionalTransientErrorNumbers != null && additionalTransientErrorNumbers.Contains(error.Number))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This lets users opt into retrying SQL error -2, but the built-in exclusion above is deliberate because a command may have completed on the server before the client timed out. Retrying can repeat a non-idempotent operation. Could the setting's documentation call out this risk so users don't treat every added number as safe to retry?

This branch has not been deployed

No deployments
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.

Azure SQL transient error

2 participants