Skip to content

[9.x] Detect broken connection after MSSQL upgrade#44121

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
Namoshek:patch-1
Sep 14, 2022
Merged

[9.x] Detect broken connection after MSSQL upgrade#44121
taylorotwell merged 1 commit into
laravel:9.xfrom
Namoshek:patch-1

Conversation

@Namoshek
Copy link
Copy Markdown
Contributor

After upgrading our SQL Server cluster last week, which normally fails over gracefully and happens with zero-downtime, we experienced the following error in a few of our pods until manually restarting them:

SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'SomeUser'. Reason: Server is in script upgrade mode. Only administrator can connect at this time.

Apparently, when applying a patch to SQL Server, it will go in script upgrade mode during the recovery phase while restarting to patch system objects (like system tables and views). The time this takes depends on the patch and what objects it needs to update. Most times it will take like a minute or two. More details can be found in this blog post.

Since this is a very rare issue and hard & time consuming to reproduce, and because restarting our containers to force a reconnect to SQL Server helped, I assume this can be seen as an error indicating a broken connection. The SQL Server Management Studio (a Windows GUI) actually detects this error as a failed attempt to connect (as can be seen in this screenshot).

@taylorotwell taylorotwell merged commit ca0c5e2 into laravel:9.x Sep 14, 2022
@Namoshek Namoshek deleted the patch-1 branch September 14, 2022 16:18
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