Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Object reference not set to an instance of an ....

Author  Topic 

mbbraunb
Starting Member

3 Posts

Posted - 2015-03-03 : 12:36:57

Hi, I have searched everywhere for an answer to this problem and I'm hoping someone here may be able to shed some light.
I use a remote desktop app to log in to a server where I run my queries. Sometimes with a long-running query (say 1-4 hours) when I check on it a few hours later or the next morning, it is still running when my message window clearly shows it completed all of the steps. I'll hit Stop and a window pops up that says "Object reference not set to an instance of an object." Then the status changes to "Canceling..." and it hangs there indefinitely. If I close the window then SQL Server Management Studio crashes and I have to start over. As long as my RDP connection never breaks I do not have this error.

I have no idea how to even debug this error. I've tried shrinking my tempdb (my queries use a lot of temp tables), but even with a fresh tempdb I'll still get the error. It seems to have something to do with the fact that I'm using remote desktop but I can't imagine how that would play a role, I just know that it never happens if I do not break my RDP connection until the query has completed.

This is really impacting my ability to do my job and I greatly appreciate your help!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-03 : 13:48:17
Do the long-running queries return a lot of data?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mbbraunb
Starting Member

3 Posts

Posted - 2015-03-03 : 16:35:52
Sometimes they end with a final temp table insert, sometimes I do a select on the final table so that I can at least get the data out if it crashes. In either case, there are usually up to 400K records in the final table.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-03 : 16:48:34
I would be suspicious of the RDP settings on the server. It's likely setup to disconnect you after a certain amount of time, hence why you only have an issue with long-running queries. I know at my previous job on some of the older servers, we were disconnected after 2 hours to ensure people weren't hogging the connections.

Open up Remote Desktop Session Host Configuration (or similarly named) on the server and check the settings.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -