SQL Server – Instance not starting or crashing immediately. Error 17065. EXCEPTION_ACCESS_VIOLATION

Ok now this is same soup with different recipe and ingredients, which here means same type of trouble which we discussed in our last post but a very different approach for resolution as the problem is new.

Just like last one, nobody wants to be in this situation but unlike the previous situation which we discussed, this one is more severe as it can occur any fine day causing things to go hay wire with people panicking and chasing what has happened. Why their application has suddenly not able to reach to database or why SQL Server is not working.

Scenario

Now, let me quickly explain the situation here first. This is the situation I recently faced where in one of my projects people start getting “timeout” or “Cannot connect to <Instance>” error. I quickly reached to the server and found that instance was not up. As it was a clustered server I checked the cluster logs and found that instance failed over before crashing (usual behavior). I tried again to bring the server up from “Failover Cluster Manager” and it crashed again. I checked “Event Viewer log” and there was nothing on why it is crashing except to check SQL logs. When I went to the SQL Log’s folder I found the following errors from different files:

SQL Error Dump File:

<timestamp> Server      Error: 17065, Severity: 16, State: 1.
<timestamp> Server      SQL Server Assertion: File: <purecall.cpp>, line = 51 Failed Assertion = '!"purecall"' Pure virtual function call. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.
<timestamp> Server      ***Stack Dump being sent to <some location on server>\SQLDump0094.txt
<timestamp> Server      SqlDumpExceptionHandler: Process 5672 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
<timestamp> Server      * *******************************************************************************
<timestamp> Server      *
<timestamp> Server      * BEGIN STACK DUMP:
<timestamp> Server      *   01/29/15 00:43:10 spid 5672
<timestamp> Server      *
<timestamp> Server      *
<timestamp> Server      *   Exception Address = 0000000002080D01 Module(sqlservr+0000000001370D01)
<timestamp> Server      *   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION
<timestamp> Server      *   Access Violation occurred reading address 00003AF3ECB91D4C

SQL Exception Log File:

<timestamp> spid 0 Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION writing address 00000001769521A0 at 0x00000001769521A0
<timestamp> spid 0 Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION reading address 00000000803D61A0 at 0x00000000803D61A0

The Resolution

If you’re also getting the same error than this blog is for you. Now, to recover from the above error what you can do is that:

1. You can apply the relevant hotfix (which you can find on this link) or latest service pack for your SQL version. I chose the latter and upgraded the SQL Server 2008 R2 SP2 to SP3 as service packs are usually more stable.

2. However, it is interesting to note patching only gave SQL Server the ability to bypass this error and continue functioning normally however it doesn’t necessarily do away with error(s) above. To remove the error completely just ensure that on all the SQL Server location, the SQL Server service account(s) have full control. 

Once I reapplied the relevant permissions on the each folder, I was finally able to stop SQL Dumps and the errors from re-occurring. Though this last step can also be used as work-around in case you don’t have enough time in your hand to do patching however I would strongly suggest to have latest recommended patches and/or service packs installed as soon as possible to avoid such scenarios all together.

Hope you find this post useful and able to resolve your issue.
Please share your values comments and share the post if you liked it.


Comments

Popular posts from this blog

SQL Server: SQL Server services not starting. TDSSNIClient initialization failed with error 0x139f, status code 0x80. Reason: Unable to initialize SSL support.

SQL Server 2014 SP\CU installation getting stuck at “MsiTimingAction”

SQL Server: Cluster Installation failed with error “Wait on the Database Engine recovery handle failed.”