Antonio Petricca
Antonio Petricca

Reputation: 10996

WCF MaxConcurrentSessions exceeded

I am hitting into a problem with my company application.

I am going to summarize the system key elements:

  1. My company's system is running since few years on Windows XP and 7 (Home, Pro, Basic) machines.
  2. It has been written in .NET 4.0 and based upon WCF.
  3. It uses the default throttling values (MaxConcurrentSessions = 100 * CPU (4) : enough for our workload).
  4. The main service is hosted by a stand alone deamon process (not IIS).
  5. The main service is configured as Multithraded/PerSession instances.
  6. The protocol is Reliable NET.TCP.
  7. No more than 10 clients access concurrently the service.

The problem is that only on Windows 7, intermittently, I get (I discovered that by the WCF full trace log) a "Server too busy exception" due to an exhausted MaxConcurrentSessions limit (impossible!!!).

Do you have any idea about this strange behaviour?

Thank you and have a Happy New Year!

Antonio

Upvotes: 4

Views: 3108

Answers (2)

Seymour
Seymour

Reputation: 7067

We experienced a similar issue with a self-hosted WCF interface which provided a synchronous request/response web service for an asynchronous (2 one way service calls) backend request. Early in our testing, we noticed that after a somewhat variable amount of time, our service became unresponsive to new requests. After some research, we discovered that whenever the backend service (out of our control) did not send a response, we continued to wait indefinitely and as such we kept our client connection open.

We fixed the issue by providing a “time-to-wait” configuration value so we were sure to respond to the client and close the connection. We used something like the following …

Task processTask = Task.Factory.StartNew(() => Process(message));

bool isProcessSuccess = processTask.Wait(shared.ConfigReader.SyncWebServiceWaitTime);

if (!isProcessSuccess)
{ 
 //handle error … 
}

The following link, which provides information regarding WCF Service performance counters, may help further determine if the calls are being closed as expected. http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/11/wcf-scaling-check-your-counters.aspx

Hope this helps.
Regards,

Upvotes: 1

AFract
AFract

Reputation: 9723

Do all your Clients properly close/dispose connection to service after use ? It's worth to check, "ghost" connections could maybe explain this.

Upvotes: 1

Related Questions