SuperSocket icon indicating copy to clipboard operation
SuperSocket copied to clipboard

SendingQueues do not get released on duplicate SessionID (v1.6.x)

Open ElStefan opened this issue 4 years ago • 3 comments

Hi,

I wanted to bring this up again since v2.0 is still in preview on NuGet and we've been using v1.6.6 for a few years now. There is a bug on the 1.6 branch - which also may have caused #100

If a client makes hundreds of connections, this error message appears sometimes: The session is refused because the it's ID already exists! which is ok, the session does not get processed further.

But.. at this point there is already a SendingQueue reserved for this session and it does not get released again. That works until all sending queues get reserved and then this error appears: There is no enougth sending queue can be used and the server stops responding.

I fixed it by changing

if (!AppServer.RegisterSession(appSession))
    return null;

to

if (!AppServer.RegisterSession(appSession))
{
    socketSession.Close(CloseReason.ServerClosing);
    return null;
}

in the UdpSocketServer class

It might not be the right way to solve this, but I hope it points you to the right direction.

Kind regards and keep up the great work! Stefan

ElStefan avatar Nov 25 '20 15:11 ElStefan

Good catch:

I just did a fix. Thank you!

https://github.com/kerryjiang/SuperSocket/commit/831910a8c5a5e8e94a22ecc7ba595855fe0c9331

kerryjiang avatar Nov 26 '20 07:11 kerryjiang

Good catch:

I just did a fix. Thank you!

831910a

I have the same problem. Will this version be updated on nuget?

howielin avatar Dec 10 '20 07:12 howielin

No, could you build from the source code by yourself?

kerryjiang avatar Dec 10 '20 07:12 kerryjiang