When we kill the clientside connection with smartfox.KillConnection(), if we send any sort of server request before reconnection occurs then after reconnecting the server immediately kicks the client. Locally reconnection has no issue, this may just be because local reconnection is so quick.
Serverside the following messages are given:
Code: Select all
Session created: { Id: 17739
User login: A
Room joined: R
Session created: { Id: 17741
Session removed: { Id: 17741 (not clear on why this extra session exists)
Session was resurrected: { Id: 17739,
Reconnected USER: A
Session removed: { Id: 17739
User disconnected: A
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: System Request rejected: client is not using an encrypted connection. Request: SetUserVariables, User: A
Description: Runtime error while processing request
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.controllers.BaseControllerCommand.checkRequestPermissions(BaseControllerCommand.java:150)
com.smartfoxserver.v2.controllers.BaseControllerCommand.checkRequestPermissions(BaseControllerCommand.java:197)
com.smartfoxserver.v2.controllers.system.SetUserVariables.execute(SetUserVariables.java:41)
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:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Session created: { Id: 17742, (unsure about the existence of this session as well)
com.smartfoxserver.bitswarm.exceptions.SessionReconnectionException: Session Reconnection failure. The passed Session is not managed by the ReconnectionManager: java.nio.channels.SocketChannel[connected local= remote=]
com.smartfoxserver.bitswarm.sessions.DefaultReconnectionManager.reconnectSession(DefaultReconnectionManager.java:155)
com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.reconnectSession(DefaultSessionManager.java:373)
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:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
com.smartfoxserver.v2.exceptions.SFSRuntimeException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: System Request rejected: { Id: 17742, Type: DEFAULT, Logged: No, IP: }, Client is not logged in.
Description: Runtime error while processing request
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.controllers.BaseControllerCommand.checkRequestPermissions(BaseControllerCommand.java:112)
com.smartfoxserver.v2.controllers.BaseControllerCommand.checkRequestPermissions(BaseControllerCommand.java:197)
com.smartfoxserver.v2.controllers.system.SetUserVariables.execute(SetUserVariables.java:41)
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:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
After this I get the same Client not logged in message a few times before the client disconnects and session 17743 is removed.
On the client side I get this order of events:
Code: Select all
Command KillConnection done
[SFS - ERROR] [TCPSocketLayer] General error reading data from socket: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall.
OnConnectionRetry
OnConnectionResume
[SFS - ERROR] [TCPSocketLayer] Connection closed by the remote side
OnConnectionRetry
OnConnectionLost
This is all an encrypted connection, however the local testing was setup with encryption as well and local reconnects fine. We also reconnect fine if the client is standing still and sends no messages. I've tried blocking all messages to Smartfox while disconnected but it seems due to timing issues some will still be sent while disconnecting, or perhaps right after reconnecting (judging by the messages server side complaining about unencrypted an SetUserVariable request) if the client is moving around while the disconnection happens.
This is completely reproducible and seems to have the same order of error messages and content as I showed above. We only call smartfox.connect() once so I do not know where these extra sessions come from.
Any thoughts on where to look for what this problem might be? Thanks so much for any advice! If you want to discuss this with the full logs or request any code we can take this off the forums as well of course.