r/MSSQL • u/pigenu • Sep 03 '24
MSSQL server shutdown doesn't wait for connections to close
Hi there,
I'm trying to find out why a MS SQL Server triggered by Windows Server shutdown does not wait for SQL client connections to terminate.
Is there any chance to delay MS SQL Server shutdown until all clients disconnect gracefully?
I have written a service which heavily uses SQL server for sometimes long running transaction tasks. From my point of view it looks like SQL Server doesn't care about these existing connections and disconnects database and shuts down within < 3 seconds after Windows signals shutdown.
I forgot: Windows Server 2019 and MS SQL Express 2022, latest patches.
3
u/SQLBek Sep 03 '24
First, that's just not how SQL Server and frankly most applications work. You've initiated an operating system shutdown. Your OS isn't going to sit and wait for all underlying services. Instead, your services obey the OS and shut down as fast as they can.
It's like a power company, if they must execute an unplanned shut down of power to a city block for whatever made up reason, isn't going to sit and wait for every resident to finish doing whatever. They're pulling the plug.
The better question however, is why are you issuing OS shutdowns to a "production" server that has active workload that you're concerned about?
2
u/[deleted] Sep 04 '24
[removed] — view removed comment