Good afternoon, I wanted to share with you a problem I'm having, which you can not find a convincing answer.
What is the problem?
It is that database connections are many active and AWAITING COMMAND status SLEEPING, and every time I run a new query to the database, a new connection is added, I see this with sp_who2 from Management Studio.
What is the scenario?
An application of three layers (BUSINESS, DATA and PRESENTATION) which, because it is a client-server application, data is accessed by a Windows service that raises a
console application that instantiates a class that encapsulates access to data and records on the server so it can be accessed through Net Remotting.
Proper operation, can access data and execute everything correctly. At each attempt to access data, I end with Connection.close () method.
The problem is that despite using Connection.close () connections do not die and are all state SLEEPING, and there comes a time when you can no longer accumulate more
and SQL SERVER rejects the connection attempt, because limit was reached in the POOL.
Even if I close the main application, connections are maintained, but if I close the application that instantiates the object, all connections are closed.
Anyone has been in a similar situation? any suggestions?
Hi again, i've implemeted the Dispose method on the conection object and it's seems to be the solution, first close, then dispose.
I also made some changes, before the Windows Service starts a mini app than register the remote object in a tcp channel, now the Windows services does all the work, and no extra app is needed, so, the solution copuld be bay one of thos changes or a combination.
Actually, you're looking at two different things. Visual Studio Online is not the Visual Studio IDE in the cloud. There is one feature of VSO that does enable you to edit code in the cloud, but it's only for websites deployed to Azure. See: Visual Studio Online "Monaco" videos on Channel 9.
Visual Studio Online is essentially a cloud implementation of Team Foundation Server with some additional cloud-based functionality. You should go ahead and create a free Visual Studio Online Basic account. That'll give you a place in the cloud for online source control. As you learn to code, you should also learn how to work with source control.
Express for Windows Desktop is the IDE heir to what was once Visual Basic Express, Visual C# Express, and Visual C++ Express. All three of those products (2010 era) are now what comprises Express for Windows Desktop. It's the best starting point for learning to code with any of those languages, and it connects to Visual Studio Online. For ASP.NET development, you'll need a separate Express product: Express for Web.
Agree with others. Go with Visual Studio Express. If you need cross platform option(some people use VMs to run other OS), use MonoDevelop[^]. FYI one more open source IDE SharpDevelop[^] there as an alternative.
Hey, all. Been after this one a few days and it's driving me crazy. I've refactored several times based on information I've found on the net (i.e. event handlers, circular references, etc) but I'm just not getting anywhere.
What I have is a generic hierarchical data structure that is distributed over a LAN via TCP. The concept was that I wanted to be able to share variables between applications over networked machines using a common protocol. The problem is whenever I run the thing and watch the process with Process Explorer, I can see a steady increase in Physical Memory usage (WS Private). I have a test application that accesses the nodes in the tree several times a second and can watch it climb (app consumes about 50 MB of memory when idle and then climbs at about 300 K per second). By playing around and commenting/uncommenting various blocks of code, I've narrowed the problem down to whenever the nodes in the tree are being accessed. At first I was certain that the problem was in the implementation of my object hierarchy because I had circular references (children had a reference to their parents) and figured that was messing up GC. But then I redid the implementation to remove that relationship and it's still happening. This is really driving me nuts.
Here's some (abridged) code. I can provide more if needed but don't want this to turn into a novel outright.
First, the object hierarchy:
Starts with a MustInherit base class: Node
Node is just a basic node in the tree. Everything that lives in the tree must inherit from this class.
Inherits from Node. It has an internal sortable dynamic list of Node instances and includes methods necessary to traverse that list (HasChildren, etc).
Inherits from ContainerNode. A Cluster is a collection of related nodes. A Cluster is the top most object in the tree. A Cluster contains a list of Groups and DataNodes.
Inherits from ContainerNode. A Group is a collection of related nodes within a Cluster. A Group contains more Groups and DataNodes.
Inherits from Node. A DataNode is a variable "leaf" item on the tree. It can be any kind of basic data type (string, integer, etc, etc).
The whole tree is accessed through a class called Agent. The Agent provides the methods necessary to add and remove nodes and set their values. It also sends changes in the tree out to the network and receives requests from connected clients over the network to modify the tree.
Nodes on the tree each have a signature, which looks pretty similar to a directory path in Linux (/Cluster/Group/Group/DataNode). I don't deal with relative paths.
So after a bunch of screwing around I've traced the problem down to whenever I access a node on the tree. Up at the App level, I have the following:
This corresponds to a property in a class called Service, which exposes the Agent and everything else to client applications (this whole thing is packed into a class library).
PublicProperty NodeValue(ByVal Path AsString) AsObjectGetReturn m_Agent.NodeValue(Path)
EndGetSet(ByVal value AsObject)
m_Agent.NodeValue(Path) = value
Within Agent, there is the following:
PublicProperty NodeValue(ByVal Path AsString) AsObjectGetTryReturnDirectCast(Me.GetNode(Path), Tree.DataNode).Value
Catch ex As Exception
ReturnNothingEndTryEndGetSet(ByVal value AsObject)
TryDim N As DataNode = DirectCast(Me.GetNode(Path), Tree.DataNode)
If (N IsNotNothing) ThenIf (N.NodeVal <> value) Then
N.NodeVal = value
If (Me.SuppressEvents = False) Then
EndIfEndIfEndIfCatch ex As Exception
GetNode does this:
PublicFunction GetNode(ByVal Path AsString) As Node
If (m_Nodes.IsEmpty) ThenReturnNothingEndIfIf (String.IsNullOrEmpty(Path)) ThenReturnNothingIf (Path.Equals("/")) Then
EndIfIf (Path.Substring(0, 1).Equals("/")) ThenReturn AbsolutePath(Path)
EndIfReturnNothingEndFunctionPrivateFunction AbsolutePath(ByVal Path AsString) As Node
Path = Path.TrimStart("/")
Dim Data() AsString = Path.Split("/")
If (Data.Length > 0) ThenDim Index AsInteger = m_Nodes.GetItemIndex(New SearchNode(Data(0)))
AbsolutePath = m_Nodes.AtIndex(Index)
If ((AbsolutePath IsNotNothing) And (Data.Length > 1)) ThenFor X AsInteger = 1To Data.Length - 1If (AbsolutePath IsNotNothing) ThenIf (AbsolutePath.HasChildren) Then
AbsolutePath = DirectCast(AbsolutePath, ContainerNode).Child(Data(X))
Now, through testing, I've found that calling GetNode is enough to make the memory leak occur. That means no events firing and nothing else special, just a simple GetNode, which returns the Node instance back to the caller.
It seems to me that this should be something that the language should be able to handle, so I'm either missing something fundamental or I'm nowhere near as knowledgeable as I'd like to believe.
I greatly appreciate any help, hints, or insight you can provide.
Last Visit: 31-Dec-99 19:00 Last Update: 26-Nov-14 13:39