11-07-2008 09:20 AM
Hi - I need to have an application alternate on a timer between two DataSocket Servers. It works Ok but dies after a few hours because it accumulates handles (as observed on Task Manager) at the rate of 12 new ones per iteration. This stops the application working when the handle count reaches 39000 or so, having started at about 6000. Available memory does not change much and there is still plenty left at that time.
This is a bug! If anyone has ideas and/or a workaround, that would be great.
Thanks, Stephen M-L
11-10-2008 12:45 PM
Hello Stephen,
I have a few additional questions for you:
Thank you advance for the answers to these questions!
11-10-2008 04:21 PM
Hi Matt -
These are connections to existing servers, mode is ReadAutoUpdate. I do not think I have a means of finding out what they refer to, but they are allocated exactly when the next DataSocket.ConnectTo is executed (after doing a Disconnect on the connection to the previous server. I am doing this in VB6, and observing the handle count in Task Manager as I step through the program in debug mode. (I was trying to find out whether the machine was running out of memory, or what). The behavior is reprodicible and is the same as when it is running on a dedicated machine with nothing else running. The starting 6000 handles are the total for Windows, which is typical. The program fails when the handle count reaches 39000 or so.
Thanks, Stephen M-L
11-11-2008 07:43 PM
Stephen,
Another quick question for you:
Are you using the same DataSocket (or even possibly the same two DataSockets since you are alternating) or are you creating a new DataSocket in each instance of execution/alternation? One approach you might employ, which may already be the case, would be to use the same DataSocket, Disconnect(), simply change the URL of that one DataSocket, and then call Connect() again. Like I said, you may already be doing this, but I wanted to make sure. Again, thanks in advance for this information!
Cheers,
11-12-2008 09:16 AM
Hi Matt - Yes, this is exactly what I am doing - Disconnect and then re-connect with the new URL. The extra handles are taken coincident with the re-connect. The most likely conclusion is that the handles used by the connection are not returned to the system when the Disconnect takes place. In fact Task Manager confirms this - there is no change to the handle count when Disconnect executes. (Stepping through the program.)
Regards, Stephen M-L
11-13-2008 10:44 AM
Hello Stephen,
I appreciate your patience as I have looked into the issue further. It appears that the newer versions of Measurement Studio that correlate to the newer verisons of Visual Studio .NET include a method called Dispose() to address this issue. In fact, the documentation for these versions stresses the use of Dispose() as almost necessary, presumably to address this very issue.
Unfortunately, I was able to confirm that Dispose() is not an available function in the DataSocket library of Measurement Studio for VB 6. I understand the frustration regarding how this might limit your application as you have already witnessed. The only work around I can conceive of would be to leave two separate DataSockets open, each with one of the two server URLs, and never call Disconnect() on either of them until the end of execution. I would be curious to see if this limits the handle count.
Best wishes,