No Exceptions should be raised by this code

Hit a fun error today throwing a Severity 020 error. Here is the error from the Error Log

SQL Server Assertion: File: <qxcntxt.cpp>, line=956 Failed Assertion = '!"No exceptions should be raised by
this code"'. 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.

The error was happening every hour at 34 minutes past the hour. The problem started at 4:34PM the day before and was consistently happening every hour. I figured I had a SQL Agent job throwing some error or something. However after some searching around this error seemed pretty rare.

The alert notification email had some more clues:

Process ID 67 attempted to unlock a resource it does not own: DATABASE: 30 . Retry the transaction,
because this error may be caused by a timing condition. If the problem persists, contact the database administrator.

I figured that the DATABASE: 30 was a reference to a database with the DB_ID of 30. However there was no database with the ID of 30 in the instance. The highest DB_ID was 28. I fired up a SQL Profiler trace to see if I could capture the session and the statement. The Process ID was showing up in the alert email so that helped me track down the statement.

SELECT database_id, object_id, index_id, partition_number, page_io_latch_wait_count, page_io_latch_wait_in_ms
FROM sys.dm_db_index_operational_stats(null,null,null,null)
WHERE page_io_latch_wait_count >0

We have a Diagnostics tool that was running the SQL Statement above. I ran the statement in SSMS and was able to reproduce the error. So now what. Well I noticed we had some databases that were set to Offline. We are in the process of decommissioning this server. I detached a couple of the databases and the statement completed with no errors.

Above the statement that was erroring out was a query to grab all the databases on the server and throw them in a table. My guess is that the statement used to grab all the databases grabbed one of the Offline Databases by mistake. Then the sys.dm_db_index_operational_stats procedure was executed against the offline database thus throwing this wild error.

One problem with that theory is that the offline database was not being returned in the database list query. So maybe the diganostics tool was running off a cached copy of the database list or something. Not sure. Anyway, after the databases were detached the problem went away.

The following feature couldn’t be installed .net framework 3.5

I entered an almost infinite loop of installation fun on Windows Server 2012 the today. I wanted to share my adventure with others in an effort to save time and prevent you from drop-kicking your laptop like I almost did.

How it all started

  1. Started install of SQL Server 2014 on fresh Windows Server 2012 build
  2. Install reported I needed .NET 3.5 Service Pack 1 to continue
  3. Launched Server Manager
  4. Clicked Add Roles and Features
  5. Clicked through to the Features list and selected .NET Framework 3.5 and then clicked install

At this point I entered the almost infinite loop. The install failed several times. I tried going to the Microsoft website to get the install. When I launched the install I was delivered a message that you are not cool and that this won’t work, go back to add features in Server Mangaer.

First Lifeline

First lifeline was found in this support article from Microsoft: This article has a section on troubleshooting error code 0x800F0907. I followed the steps in this article and was able to add the .NET 3.5 Feature using server manager.

The Fix

Her is how I fixed the problem.

  1. Open Group Policy Editor
  2. Browse to Computer…Administrative Templates…System
  3. Double click on the Speciy settings for optional component installation and component repair option.
  4. Click Enable and check the box next to Contact Windows update directly to download repair content instead of WSUS
  5. Click OK
  6. Launch an elevated command prompt and type in gpupdate /force to update the Group Policy
  7. Return to the Server Manager and try to add the .NET 3.5 Service Pack 1 Feature.
  8. Crack open celebratory Mt. Dew and bask in the warm glow of your dominance.

2014-10-06 13_04_10