Sql-server – “Cannot continue the execution because the session is in the kill state” Error

sql serversql-server-2019

We use SQL Server 2019 Standard edition on Windows Server 2019. We have 200 users and thousands of connections at the same time.

SQL Server 2019 raises an error

Cannot continue the execution because the session is in the kill state

Once a week I restart the SQL Server service and the error is gone.

  • I installed CU1, CU3, CU4, CU5 and CU6, but that didn't fix the error.

  • Database's compatibility level: SQL Server 2019 (150)

  • Our programs use mostly 4 tables. I read that broken indexes could cause this error. I checked these tables' indexes, but no problem was found. Anyway, I rebuilt all indexes for these 4 tables, but that didn't fix the error.

How could I detect the root cause of this error, and how could I fix it?

Thanks.


i modify a stored procedure and test it, error raised.

in sql server management studio :

Msg 596, Level 21, State 1, Line 93
Cannot continue the execution because the session is in the kill state.
Msg 0, Level 20, State 0, Line 93
A severe error occurred on the current command.  The results, if any, should be discarded.

in exception.log file :

09/21/20 12:23:33 spid 697 Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION reading address 000001BDA9BA6000 at 0x00007FF8BCD099B3

in SQL Server Log:

2020-09-21 12:23:33.62 spid697     CImageHelper::Init () Version-specific dbghelp.dll is not used
2020-09-21 12:23:33.62 spid697     Using 'dbghelp.dll' version '4.0.5'
2020-09-21 12:23:36.07 spid697     ***Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\LOG\SQLDump10000.txt
     SqlDumpExceptionHandler: Process 697 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
     * *******************************************************************************
     *
     * BEGIN STACK DUMP:
     *   09/21/20 12:23:36 spid 697
     *
     *
     *   Exception Address = 00007FF8BCD099B3 Module(sqllang+00000000009099B3)
     *   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION
     *   Access Violation occurred reading address 000001BDA9BA6000
     * Input Buffer 150 bytes -
     *             dbo.SP_STOCK_INFORMATION '', '175812'
     *  , 7
     *  
     *
     *  MODULE                          BASE      END       SIZE
     * sqlservr                       00007FF78DE00000  00007FF78DE9DFFF  0009e000
     * ntdll                          00007FF8D4640000  00007FF8D482CFFF  001ed000
     * KERNEL32                       00007FF8D4170000  00007FF8D4222FFF  000b3000
     * KERNELBASE                     00007FF8D0BE0000  00007FF8D0E73FFF  00294000
     * CRYPT32                        00007FF8D07F0000  00007FF8D09CBFFF  001dc000
...

    Stack Signature for the dump is 0x00000001415746C8
External dump process return code 0x20000001.
External dump process returned no errors.

2020-09-21 12:23:39.73 Server      Error: 17310, Severity: 20, State: 1.
2020-09-21 12:23:39.73 Server      A user request from the session with SPID 697 generated a fatal exception. SQL Server is terminating this session. Contact Product Support Services with the dump produced in the log directory.

Thanks.

Best Answer

Solution

The solution to your issue is contained in the error message you included in your question:

2020-09-21 12:23:39.73 Server      A user request from the session with SPID 697 
                                   generated a fatal exception. SQL Server is 
                                   terminating this session. 
                                   Contact Product Support Services with the dump 
                                   produced in the log directory.

Make sure you can collect the ***Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\LOG\SQLDump10000.txt file and open up a service request with (your) Microsoft (representative/consultant). In some cases you might find a minidump *.dmp file located in the same location.

Include everything in the case and hopefully Microsoft will be able provide you with a solution to your issues.

Recommendation (On a Side Note)

I noticed that the log files are generated in the C:\ drive. Normally this drives hosts the Operating System (OS). It isn't recommended to run SQL Server on the OS drive. If the database or anything related to the database produces a large amount of data, then this could fill up the OS drive, which eventually could crash the system.