B4J Question (RESOLVED)Socket Threads

Jmu5667

Well-Known Member
Licensed User
Longtime User
I have a B4J console app that accepts TCP connections. They are raw socket connections not HTTP. There is a class that handles the connection so each time a new connection is request a new instance of the class is created and it handles the connection. Everything is working fine.

I am monitoring the app using VisulaVM 1.3.9 and have noticed the following:

1. When a new connection is established 3 thread seem to be created. In img below its Thread 4,5,6
Notice Thread 6 is a sleeping Thread
upload_2017-3-22_9-5-41.png


2. when I close the connection I see the following: thread 4,5 are terminated but thread 6 is still sleeping
upload_2017-3-22_9-7-11.png


My question is what will happen Thread 6 ? Is this a memory leak ? Should I be concerned ?

Regards

John
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
I have found out what the problem is. In the socket class I had a timer. If the socket class is not termination is not trapped within the class, (a class dispose event would be great), the timer is left enabled and this appears to be the sleeping thread, by removing the timer the Sleeping Thread is not created.

When the client connection terminated, I would have expected my astmClient_Terminated event to fire which would have allowed me do the class cleanup.


Thoughts views would be appreciated.

BTW I am using Beta 5

Edit: The astmClient_Terminated was named incorreclty should have been aStream_Terminated
 
Upvote 0
Top