Socket Disconnection after upgrade SFS2.13.6 from 2.11

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

djangir1
Posts: 4
Joined: 24 Oct 2019, 08:05

Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby djangir1 » 24 Oct 2019, 08:14

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
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby Lapo » 24 Oct 2019, 08:56

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?
Lapo
--
gotoAndPlay()
...addicted to flash games
djangir1
Posts: 4
Joined: 24 Oct 2019, 08:05

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby djangir1 » 24 Oct 2019, 09:09

TCP connection is working fine with 2.13.6 but socket connection is getting reconnected in 2.13.6
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby Lapo » 24 Oct 2019, 09:35

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
Lapo

--

gotoAndPlay()

...addicted to flash games
djangir1
Posts: 4
Joined: 24 Oct 2019, 08:05

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby djangir1 » 24 Oct 2019, 10:13

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.
djangir1
Posts: 4
Joined: 24 Oct 2019, 08:05

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby djangir1 » 24 Oct 2019, 12:12

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.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby Lapo » 24 Oct 2019, 12:43

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
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby ekrem5353 » 19 Nov 2019, 07:16

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
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket Disconnection after upgrade SFS2.13.6 from 2.11

Postby Lapo » 19 Nov 2019, 11:11

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
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 49 guests