Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

"There are not enough free System Resources to perform this operation."

Posted on 2006-11-10
8
Medium Priority
?
447 Views
Last Modified: 2008-01-09
I get this error "There are not enough free System Resources to perform this operation." while running a report engine that I'm upgrading to use ADO.NET (worked fine with ADO).  It is essentially checking a Queue table every 3 seconds to see if a request has been made.  I'm using a SQL Data Reader, SQL Connection and SQL Command.

Here's the odd thing though, when the program throws the system resources error there are still plenty of system resources left.  The hard disk has 8 of 20 gig left.  The engines at crash time are taking up 54MB and 37MB of memory respectively and the commit charge via the task manager is only 287MB/1246MB.

I'm disposing of my SQLCommands and setting the commands and data reader = nothing.  The connection is left open throughout the lifetime of the .EXE.  Thoughts on why this is happening?
0
Comment
Question by:IUFITS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 17915992
This isn't an answer, but I've had this before and a reboot sorted it out.
Never found out what the problem was though :(
0
 
LVL 3

Author Comment

by:IUFITS
ID: 17916443
I'm puzzeled, the other kicker is, I have two database connections each database residing on a different server (one is our error and notification logging database).

                Dim Sqlstmt As String = "UPDATE tbl_Application_Codes SET ProgramLastRun='" & Now() & "', ProgramLastRunBy='" & My.User.Name & "', ProgramLastRunIP='" & GetIPAddress() & "' WHERE ApplicationCode='" & pAPPLICATION_CODE & "'"
                Dim myConnection As New System.Data.SqlClient.SqlConnection("server=<server>;database=Error_Log;uid=<user>;pwd=<Password>")
                myConnection.Open()

                Dim myCommand As New System.Data.SqlClient.SqlCommand(Sqlstmt, myConnection)
                Dim p As Integer = myCommand.ExecuteNonQuery()

                myCommand.Dispose()
                myCommand = Nothing
                myConnection.Close()
                myConnection = Nothing

I'm running the above code in the form load event of the main form.. it calls a sub in an custom notification object which contains the above... now, to me it looks like the connection should open, run the statement and close, but it doesn't and it doesn't throw an exception to make me think it's not getting there.  There continues to be two open connections to that database server and countless others with TIME_WAIT (I can only assume it opens then closes many over and over because the port number continues to go up when I check netstat)....   Clearly there is something I don't understand with the connection process.
0
 
LVL 3

Author Comment

by:IUFITS
ID: 17916651
I'm utterly perplexed.  Something else I noticed which is flakey, I removed SERVER1 from EVERY connection string in my source code a while back...  it's NOT there but my program continues to open up connections to it and close them (or I assume that because there's a slew of TIME_WAIT connections when my program starts).  Why does it continue to reference it... when I start my program and run netstat to monitor (I've used a packet sniffer which verifies my program is sending that server info).

How can my program be opening or talking to a server that exists nowhere in my code (though it used to) and could this somehow be related?  This makes me miss my trouble free version with classic ADO.  :P
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 3

Author Comment

by:IUFITS
ID: 17916857
Disregard the SERVER1 comment...  I forgot this is a report server and server1 was where the report was getting it's data from.  :P  This perplexed on the memory issue though.  Does it matter what order your dispose and set things equal to nothing in?
0
 
LVL 3

Expert Comment

by:magpie3d
ID: 17928752
.NET will pool database connections, and keep them open for a while in case they are needed again.  That could explain why it looks like the connections aren't being closed.

I would call Dispose on the Connection object too, just be sure that it's not leaking anything.
0
 
LVL 5

Accepted Solution

by:
prashantagarw10 earned 2000 total points
ID: 17929755
I also got this prob. and i think i added something to connection string to fix this up.
I think it was something like connectiontimeout or simply timeout.

By the way why do u keep closing and opening connections everytime. Dont close a connection. Use persistant connection which u open at start of report. and close it at application end. and to address the problem in between by closing of conn. use a good try catch block and call ur sub to open a conn. in case its broken in between.

Prashant
0
 
LVL 5

Assisted Solution

by:prashantagarw10
prashantagarw10 earned 2000 total points
ID: 17929789
I think i got it. It was Connection Lifetime property. In ur case i wd. suggest to set it  to 10 in case you plan to close and open connections each time. But if you use a persistant connection dont add this to connection string.

Prashant
0
 
LVL 3

Author Comment

by:IUFITS
ID: 17990746
I set a persistant connection and re-ordered the order I was releasing objects so I didnt' leave any hanging.  That helped.  My true leak though was from using NotifyIcon and not using the DestroyIcon API to free the resource since the icon setting was just a pointer.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question