System.OutOfMemoryException occurs frequently after Upgrading SQL Server 2016 to version 13.0.15700.28

djangojazz picture djangojazz · Aug 19, 2016 · Viewed 26k times · Source

I am running Windows 10 Pro 64 bit on a dev box that has multiple monitors, 16 gigs DDR4 RAM, 4 Ghz I7, GTX 970. I run SQL Management Studio with SQL Server 2016 Developer Edition along with VS 2015 Enterprise Update 3.

Yesterday I upgraded Sql Management Studio 2016 to 13.0.15700.28 and it was like a poison pill for my machine. Now after an hour or two it will throw an out of memory except:

An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown

Now this is sometimes typical if you are doing very large return sets of over a few million rows. NOT if you are doing

Select Top 10 * from SmallObject

I was doing some new table and procedure creation for new objects to an existing development system. And this just occurs out of the blue for no rhyme or reason. It also appears to be a partial blocking error for SSMS as it now freezes the system and attempts to bring up a connection dialog window like I am first starting SSMS and attempting to connect to a datasource. Thus far it goes to a crawl until I kill it from task manager. I am also running Redgate's SQL Prompt 7.2.0.241. Things I have tried:

  1. Attempted to keep tabs under five at a time and close them as I am done.
  2. Do not break off the tabs from one screen to another.
  3. Turn off Redgate and see if it is the culprit
  4. Check memory use as I go

I know it blew up last night as I came into work and SSMS let me know it had crashed. This may be an MS bug but there may be a bug in Redgate or some other config I have so I thought it best to ask SO and see what others have seen. This build of SSMS is as of 8/15/2016 so it is very new.

Two errors from stack traces of Application Event Logs: Event 1026

Application: ssms.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info:

System.ComponentModel.Win32Exception at System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.ComboBox.CreateHandle() at System.Windows.Forms.Control.CreateControl(Boolean) at System.Windows.Forms.Control.CreateControl(Boolean) at System.Windows.Forms.Control.CreateControl(Boolean) at System.Windows.Forms.Control.CreateControl(Boolean) at System.Windows.Forms.Control.CreateControl(Boolean) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Form.WmShowWindow(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Form.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)

The other one was an event log 1002 error 'Application Hang' and has no real meaningful help that I can see:

Ssms.exe 2015.130.15700.28 68ac 01d1f98d17a32d16 4294967295 C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe 62a64950-658b-11e6-a2c8-f832e4a07fda

54006F00700020006C006500760065006C002000770069006E0064006F0077002000690073002000690064006C00650000000000

Updated 8-23-2016:

Still get this error from time to time:

The program Ssms.exe version 2015.130.15700.28 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Security and Maintenance control panel. Process ID: 35f8 Start Time: 01d1fca7e48da2da Termination Time: 4294967295 Application Path: C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe Report Id: 4e8b6ab9-693f-11e6-a2cb-f832e4a07fda Faulting package full name:
Faulting package-relative application ID:

Clearly this is an issue for people other than me as I am getting votes on it here: https://connect.microsoft.com/SQLServer/feedback/details/3062914/system-outofmemoryexception-thrown-by-even-small-selects-randomly-now

If you have this happen to you or know a potential fix, please let me know. At this point if I have to do heavy SQL work coming up I am thinking of downgrading at this point. Again I am on Windows 10 64 bit machine and this only happened after upgrading to the most recent SSMS build.

Update 8-24-2016

MS appears to acknowledge this bug now. If you have this happen to you PLEASE go to this link and upvote: https://connect.microsoft.com/SQLServer/feedback/details/3074856

Update 8-31-2016

Latest from MS on exception:

Posted by Microsoft on 8/29/2016 at 10:21 AM turns out there's a thread leak in a utility class. The number of threads leaked will be proportional to the number of registered servers you have, among other things. A fix is coming in the next release

I downgraded as doing work got more important than figuring out what was blowing up. Downgrade for me is working fine now. I gave MS SQL dumps so hopefully they can get a new build in the coming weeks. If you are curious I am on version 13.0.15600.2 and stable thus far as I downgraded two days ago.

Answer

Kapila Perera picture Kapila Perera · Mar 17, 2017

I had the same problem. I just close and reopen the SQL Server. was able to over come the error.

An error occurred while executing batch. Error message is: 
Exception of type 'System.OutOfMemoryException' was thrown.