Overview
Features
Download
Documentation
Community
Add-Ons & Services

TCPServer and ThreadPool management

Please post support and help requests here.

TCPServer and ThreadPool management

Postby DKL72 » 25 Feb 2013, 20:43

Hello:

I create a TCPServer and pass it a ThreadPool of say minCapacity = 1, maxCapacity = 3. The TCPServer accepts 3 clients so the thread pool shows allocated = 3, used = 3, available = 0. Now I disconnect all 3 clients from the TCPServer. The thread pool still shows allocated = 3, used = 3, available = 0 so I can no longer handle new clients that connect. I tried calling "collect" on the thread pool and it doesn't help. What am I doing wrong?

Thank you.
DKL72
 
Posts: 4
Joined: 25 Feb 2013, 20:26

Re: TCPServer and ThreadPool management

Postby alex » 25 Feb 2013, 22:22

What does TCPServer::currentConnections() return?
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: TCPServer and ThreadPool management

Postby DKL72 » 25 Feb 2013, 22:30

TCPServer::currentConnections() returns 0 after dropping the 3 connections.
DKL72
 
Posts: 4
Joined: 25 Feb 2013, 20:26

Re: TCPServer and ThreadPool management

Postby DKL72 » 25 Feb 2013, 22:34

DKL72 wrote:TCPServer::currentConnections() returns 0 after dropping the 3 connections.


Also, TCPServer::currentThreads() shows 3 (even though currentConnections shows 0).
DKL72
 
Posts: 4
Joined: 25 Feb 2013, 20:26

Re: TCPServer and ThreadPool management

Postby guenter » 25 Feb 2013, 22:49

Are you sure your TCPServerConnection::run() method returns when the client closes the connection?
guenter
 
Posts: 1135
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: TCPServer and ThreadPool management

Postby DKL72 » 25 Feb 2013, 23:00

guenter wrote:Are you sure your TCPServerConnection::run() method returns when the client closes the connection?


Yes, just confirmed it. I guess a good place for me to debug is inside the TCPServerDispatcher::run() and step through to see what happens after it returns.
DKL72
 
Posts: 4
Joined: 25 Feb 2013, 20:26

Re: TCPServer and ThreadPool management

Postby alex » 26 Feb 2013, 00:07

Default thread idle time is 10 seconds. You may want to experiment with different values for TCPServerParams::setThreadIdleTime() and/or wait for a while before checking currentThreads().
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests