Repository navigation
Restrict SQL Server login failure retries to post-creation checks - #38927
Merged
AndriySvyryd merged 3 commits intoSep 10, 2026
Merged
Conversation
…in failure scenarios
saifahmed34
marked this pull request as draft
September 6, 2026 09:17
saifahmed34
marked this pull request as ready for review
September 6, 2026 09:17
Contributor
Author
|
@dotnet-policy-service agree |
AndriySvyryd
reviewed
Sep 6, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The functional change is narrowly scoped and covered by targeted sync/async regression tests, with only a minor documentation clarification suggested.
Pull request overview
This PR fixes an EF Core SQL Server hang scenario where login failures (SQL error 18456) were being treated as retryable during normal existence/connectivity checks (e.g., CanConnectAsync and migration-related existence checks), by limiting 18456 retries to the post-database-creation existence check path.
Changes:
- Updated
SqlServerDatabaseCreator.Exists/ExistsAsyncretry logic to only treat 18456 as retryable when running the post-creation “retry-on-not-exists” flow. - Added unit regression coverage to ensure create-time existence checks still retry on 18456, while ordinary
Exists/ExistsAsyncdo not retry and instead throw.
File summaries
| File | Description |
|---|---|
| src/EFCore.SqlServer/Storage/Internal/SqlServerDatabaseCreator.cs | Gate 18456 retry behavior behind the post-creation existence-check flag. |
| test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerDatabaseCreatorTest.cs | Add sync/async regression tests for create-time retry vs. ordinary exists-time no-retry on 18456. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
AndriySvyryd
approved these changes
Sep 10, 2026
AndriySvyryd
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution!
This was referenced Sep 10, 2026
AndriySvyryd
pushed a commit
that referenced
this pull request
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #38886
SQL error 18456 is transient immediately after Azure SQL database creation,
but it should not be retried during ordinary CanConnectAsync() or migration
existence checks.
This change restricts 18456 retries to the post-creation existence check and
adds synchronous and asynchronous regression tests.