Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Switching between DataSockets accumulates handles

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

0 Kudos
Message 1 of 6
(7,424 Views)

Hello Stephen,

 

I have a few additional questions for you:

 

  • Is your application opening connections to existing DataSocket servers (i.e. acting as a client) or is it trying to programmatically launch the two DataSocket servers?

 

  • What do the troublesome handles refer to (i.e. separate DataSocket connections, some other resource)?

 

  • When you mention handle count, I assume you mean the number of existing handles rather than the starting value for the handle.  If this is indeed the case, why are there 6,000 handles already present when you start?


Thank you advance for the answers to these questions!

0 Kudos
Message 2 of 6
(7,397 Views)

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

0 Kudos
Message 3 of 6
(7,392 Views)

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,

0 Kudos
Message 4 of 6
(7,371 Views)

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

0 Kudos
Message 5 of 6
(7,366 Views)

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,

0 Kudos
Message 6 of 6
(7,355 Views)