Page 1 of 1

Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 08:14
by djangir1
Hi Team,

we are upgrading our server from server 2.11 to 2.13.

We achieved Login successfully but while game play we are getting frequent Socket disconnections for all sockets, even if any player is not playing that one also get socket disconnection.

This code is working fine with TCP in 2.13.6 and it was working fine with TCP and Socket in 2.11 also, I suppose its configuration related issue but not able to get any clue to resolve this.

Logs:

12:53:34,952 INFO [pool-1-thread-3] sessions.DefaultSessionManager - Session removed: { Id: 452, Type: WEBSOCKET, Logged: Yes, IP: 192.168.140.124:53468 }
12:53:34,952 INFO [pool-1-thread-3] sessions.DefaultSessionManager - Session removed: { Id: 452, Type: WEBSOCKET, Logged: No, IP: 192.168.140.124:53468 }
12:53:34,952 INFO [pool-1-thread-3] sessions.DefaultSessionManager - Session removed: { Id: 453, Type: WEBSOCKET, Logged: Yes, IP: 192.168.140.127:44420 }
12:53:34,952 INFO [SFSWorker:Sys:2] api.SFSApi - User disconnected: { Zone: Rummy }, ( User Name: yash.jaiswal, Id: 436, Priv: 0, Sess: 192.168.140.124:53468 ) , SessionLen: 8178, Type: JavaScript
12:53:34,953 INFO [pool-1-thread-3] sessions.DefaultSessionManager - Session removed: { Id: 453, Type: WEBSOCKET, Logged: No, IP: 192.168.140.127:44420 }
12:53:34,953 INFO [SFSWorker:Sys:4] api.SFSApi - User disconnected: { Zone: Rummy }, ( User Name: joshi1996, Id: 437, Priv: 0, Sess: 192.168.140.127:44420 ) , SessionLen: 5415, Type: JavaScript

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 08:56
by Lapo
Hi,
This code is working fine with TCP in 2.13.6 and it was working fine with TCP and Socket in 2.11 also

If it is working fine under 2.13.6 ... I am not sure what the problem is exactly.

Can you clarify?

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 09:09
by djangir1
TCP connection is working fine with 2.13.6 but socket connection is getting reconnected in 2.13.6

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 09:35
by Lapo
Oh you mean websocket. (Socket means just any TCP connection)
There aren't any specific settings you should use. Connections are never dropped unless a user is not doing anything for a long time, or at least as long as you configured the "user idle timer" setting in your Zones.

The logs you have reported shows two different users being disconnected. This alone doesn't look suspicious or strange. Disconnections can happen over the internet. Maybe you can give us more details?

Thanks

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 10:13
by djangir1
We have Extension scheduler task where we are handling nextTurn, TurnTime, ExtraTime and kind of functionality.
When we are sending a response to Client who all are joined using websocket are getting disconnection.

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 12:12
by djangir1
We are not facing any issue in TCP connection Its going fine but only webSocket are making problem,

Please let me know if any possibility where we can get all user disconnection in web socket but TCP is work fine.

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 24 Oct 2019, 12:43
by Lapo
Hi,
as I said the server never disconnects anyone, unless they have been idle for too long. In those cases you will see a specific message in the logs and the client will receive a custom disconnection reason called "idle".

Other than that disconnections are due to network issues of some sort, be it at the client side or any of the other nodes that their connection goes through to reach the server.

Without any other details I can't say whether or not there is a problem or where it may be.
Let us know

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 19 Nov 2019, 07:16
by ekrem5353
Hey

I had same problem when I moved from 2.11 to 2.13 only websocket clients were getting disconnected. I found that whenever I called cancel method of scheduler ( like this scheduler = SmartFoxServer.getTaskScheduler().schedule scheduler.cancel( ) some of the websocket clients were getting disconnected. I stopped using cancel method it worked for me

I hope it helps

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Posted: 19 Nov 2019, 11:11
by Lapo
ekrem5353 wrote:I had same problem when I moved from 2.11 to 2.13 only websocket clients were getting disconnected. I found that whenever I called cancel method of scheduler ( like this scheduler = SmartFoxServer.getTaskScheduler().schedule scheduler.cancel( ) some of the websocket clients were getting disconnected. I stopped using cancel method it worked for me

I don't think this is possible on a vanilla SFS2X and there must be something else going on, maybe connected with your server side code.
For starters I cannot imagine why canceling a custom Task from the Scheduler could affect existing connections in any way. Unless -again- there is specific code that interacts with those connections in your Tasks.

Also, we took the time to setup an SFS2X 2.13.7 and connected 500 websocket clients while running 20 tasks that would self cancel after a few seconds and immediately re-spawn new ones. As expected we did not encounter any disconnections or other issues with the active connections.

Cheers