sll
sll

Reputation: 62484

MaxSessionsPerAddress issue when using WCF PollingDuplex and Silverlight client

WCF Trace logs shows many "The server has hit a PollingDuplex throttle, MaxSessionsPerAddress, and cannot accept another session from this client. An http error was returned" errors.

Can't find enough details about MaxSessionsPerAddress settings, just found this post which saying that MaxSessionsPerAddress always is 10 and cannot be changed.

Just thinking may be this issue related to a fault tolerance logic I've implemented for client proxy which together with some timeout results in such issue: In case of a channel failure WCF client proxy closes a channel (Close() then Aboort() in try/catch) and then tries to reconnect each 5 seconds, N retries. Perhaps a client was not able connect even after 10 retries what created 10 sessions on a service so all next retries were refused?

General information:

WCF Client:

WCF Server:

Any help greatly appreciated!

Upvotes: 8

Views: 656

Answers (1)

sll
sll

Reputation: 62484

Main reason was that a client eventually has been failed which forces a client to reconnect too often (each 5 seconds), after reconnect a server/service receives a client's request but client again has been fauiled, each reconnect created a new WCF service session which will terminate only in 2 minutes of client polling absence, so in 2 minutes one client created too many sessions on service side.

Why a silverlight client eventually has been faulted and disconnecting? See following post which describes an actual issue and a solution: WCF Silverlight client getting 404 not found response for poll message

Other issues and solution, which were applied, perhaps anybody found helpful:

Client:

Issue: Due to different reasons channel close operation can stuck for CloseTimeout="00:03:00" minutes what is too long

Solution:

  • Set closeTimeout to 10 seconds so in case of any issue close operation will be forced in 10 seconds so client do cleanup quickly
  • Increased reconnect timeout from 5 seconds to 30 seconds to let everything releated to old channel connection to be released/cleaned up

Service:

Issue: Sometimes I saw that service is stuck while a client callback invocation (CallbackContract) for sendTimeout=30minutes because cannot complete operation due to disconnected/faulted client so service cleanup delayed for 30 minutes but should be as fast as possible released/cleaned up and disposed in case of faulted/disconnected client

Solution:

  • Set sendTimeout to 30 seconds, this is more than enough for sending few kilobytes message over the network

Upvotes: 0

Related Questions