Skip to content

dbsetup: retry a SQL Server login dropped while the server starts - #37

Open
Shriyansh Singh Sengar (sshriyansh) wants to merge 1 commit into
mainfrom
fix/dbsetup-sql-starting
Open

Shriyansh Singh Sengar (sshriyansh) wants to merge 1 commit into
mainfrom
fix/dbsetup-sql-starting

Conversation

@sshriyansh

Copy link
Copy Markdown
Collaborator

The compose end-to-end job failed once on main at 9ab8a6d (run); the rerun passed.

What happened: SQL Server's health check (sqlcmd SELECT 1) passed at 18:36:02, but SQL Server was still upgrading msdb and tempdb and logged Recovery is complete only at 18:36:04. dbsetup connected in between, and SQL Server ended the login without an error of its own. SqlClient reports that as error 0, A severe error occurred on the current command, which isn't in its transient list, so dbsetup failed on the first try instead of waiting.

The fix: dbsetup's first-connection retry also retries SqlClient's error 0. Other failures (wrong password, missing permission) still fail at once. The same retry protects a fresh deploy on Azure Local, where the SQL Server container can be starting when the dbsetup Job runs.

SQL Server can accept a connection while it is still starting and then end
the login without an error of its own. SqlClient reports that as error 0
("A severe error occurred"), which isn't in its transient list, so dbsetup
failed on its first try. Seen once in the compose end-to-end run on main
(9ab8a6d): the health check passed at 18:36:02, SQL Server logged recovery
complete at 18:36:04, and dbsetup's login in between was dropped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants