Session Reconnection failure

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

Moderators: Lapo, Bax

balasourav
Posts: 22
Joined: 25 Jul 2017, 07:44

Session Reconnection failure

Postby balasourav » 27 Aug 2019, 08:28

27 Aug 2019 | 13:53:31,212 | WARN | SFSWorker:Sys:1 | controllers.v290.SystemReqController | | com.smartfoxserver.bitswarm.exceptions.SessionReconnectionException: Session Reconnection failure. Time expired for Session: { Id: 49, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:37424 }
com.smartfoxserver.bitswarm.sessions.DefaultReconnectionManager.reconnectSession(DefaultReconnectionManager.java:154)
com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.reconnectSession(DefaultSessionManager.java:383)
com.smartfoxserver.v2.controllers.system.Handshake.execute(Handshake.java:68)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:172)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:127)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.dispatchRequest(SFSProtocolCodec.java:133)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.onPacketRead(SFSProtocolCodec.java:90)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler$1.run(BinaryIoHandler.java:477)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)


I got this WARNING At the time of re-connection. I Explain What i am done.
I develop timer based game, in my game 1st i connect sfs using router 1 connection. In between game-play i try to connect router 2 network connection at the time re-connection failed. I got this warning. What can i do for this type of warning? and how to overcome this re-connection failure error.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Session Reconnection failure

Postby Lapo » 27 Aug 2019, 13:57

Hi,
the reconnection can be done if the User is using the same IP address. If change router in the middle of a session you'll change IP address as well, which won't work.

Also, generally speaking, this should not be an issue as normally people don't change routers while playing.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
balasourav
Posts: 22
Joined: 25 Jul 2017, 07:44

Re: Session Reconnection failure

Postby balasourav » 28 Aug 2019, 13:48

I clearly Explain My scenario -
I have 2 wifi(wifi 1 and wifi 2) connection, Both of them in auto connect. if in-between game wifi 1 is disconnected wifi 2 automatically connected, at this time session re connection failure error is occur. Any possible ways there to solve this type of error ?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Session Reconnection failure

Postby Lapo » 28 Aug 2019, 15:14

Hi,
no switching network card is not supported. The reconnection system has to make sure that a client wanting to reconnect is actually who he says he is. Because of this, this particular scenario won't work.

This is akin to switching network on a mobile device. If you want to learn more about these topics I'd highly recommend these articles from our blog:
https://smartfoxserver.com/blog/what-re ... tworkwifi/
https://smartfoxserver.com/blog/handlin ... e-devices/

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Re: Session Reconnection failure

Postby marsoups » 16 Sep 2019, 06:51

Can I suggest that for a future upgrade, Smartfox moves to a sort of cookie based solution where the cookie identifies the user rather than the IP and connection ? It might help with development in this age where people are on phones and moving about so much. It will make retaining a connection so much easier.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Session Reconnection failure

Postby Lapo » 16 Sep 2019, 07:45

marsoups wrote:Can I suggest that for a future upgrade, Smartfox moves to a sort of cookie based solution where the cookie identifies the user rather than the IP and connection ? It might help with development in this age where people are on phones and moving about so much. It will make retaining a connection so much easier.

It's not that easy.
A TCP connection can be in states where it is only half-disconnected, and usually mobile devices suffer from this more than anything else.
The difficult part is determining whether the previous connection is dead or not. If the TCP doesn't trigger the event, you can get those temporary "what the heck is happening" moments, where one of the two sides is not really connected but there's no way of knowing (until a later timout triggers)

The idea of running a "cookie" works fine with a system where every request opens a connection, does its thing and then closes it. Such as in HTTP, where latency is much less of a priority than multiplayer games.

Also we already employ a cookie-like approach for the reconnection system, so that another connection can be used by the same player who lost connection earlier.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: MiltonDus and 56 guests