WHAT DOES THIS SOCKETWRITER ERROR MEAN?

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

Moderators: Lapo, Bax

User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 20 Mar 2017, 10:54

Hello!

I have an exception which I don't know why is thrown:

Code: Select all

12:46:24,474 WARN  [SocketWriter-1] core.SocketWriter     - Error during write. Session: { Id: 1, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:65014 }
12:46:24,474 INFO  [SFSWorker:Ext:4] sessions.DefaultSessionManager     - Session removed: { Id: 1, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:65014 }
12:46:24,475 WARN  [SocketWriter-1] core.SocketWriter     - java.lang.NullPointerException
        com.smartfoxserver.bitswarm.core.SocketWriter.processRegularSession(SocketWriter.java:273)
        com.smartfoxserver.bitswarm.core.SocketWriter.processSessionQueue(SocketWriter.java:217)
        com.smartfoxserver.bitswarm.core.SocketWriter.run(SocketWriter.java:193)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)

12:46:24,476 INFO  [SFSWorker:Ext:4] api.SFSApi     - User disconnected: { Zone: Vikings Fate }, ( User Name: Midgard0_Bot_Manager, Id: 0, Priv: 0, Sess: 127.0.0.1:65014 ) , SessionLen: 354341, Type: Unity


After exception you can see that an User is disconnected, this happens rarely (exception + disconnet) when I send to that user an command (which is sent often).
Also on the user side an connection lost event is triggered and there is no error message :(, so i am little confused on what is happening.

Thanks!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 20 Mar 2017, 11:34

It's a rare situation where a user is disconnected while the server is attempting to write data to such user.
Since threads work in parallel it can happen, albeit rarely. So it's not an error causing problems, rather one that indicates the specific situation (i.e. a user disappearing a microsecond before the server attempts to write data)

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 20 Mar 2017, 11:53

No it doesn't help because this is happening only with one specific user, with the most important one :D. What can I do so this user doesn't get disconnected from client side?

Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 20 Mar 2017, 13:43

No it doesn't help because this is happening only with one specific user, with the most important one

What is this supposed to mean?
Are there unimportant clients?

Network errors can be cause by a wide number of variables. It is highly likely you can't do much, because you're not in control of the User's connection.

Are you saying the problem can be reproduced now? If so how?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 20 Mar 2017, 18:15

I don't know exactly how to reproduce this exception, but this is what I do:
1. Start SmartFox
2. My extension automatically creates rooms
3. For each created room an process is started which is basically an Unity application which is used for Bots.
4. Each running instance has it's own Bot Manager which is basically an User.
5. After a couple (3-7 minutes) of time Bot Manager loses connection, you can see when disconnection happens in logs.

Thanks.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 20 Mar 2017, 20:07

TryMyGames wrote:I don't know exactly how to reproduce this exception, but this is what I do:
1. Start SmartFox
2. My extension automatically creates rooms
3. For each created room an process is started which is basically an Unity application which is used for Bots.

This is outside SmartFoxServer, I suppose...

4. Each running instance has it's own Bot Manager which is basically an User.
5. After a couple (3-7 minutes) of time Bot Manager loses connection, you can see when disconnection happens in logs.

How do these Bot Managers connect to the server? Is this running in a local network or over the internet?

If it is the latter, have you tried testing the same BotManagers locally? Do they disconnect?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 20 Mar 2017, 22:44

BotManager is located on the server machine, so yes, it is running in a Local Network.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 21 Mar 2017, 08:37

Is it always active? Meaning, does it send requests continuously?
The server will kick out users if they don't send any requests for a while. This depends on your settings for the "Idle User Timeout" in your Zone.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 21 Mar 2017, 11:14

I am using for Bot Manager same class as for clients for connection management which sends empty TCP requests to smartfox to prevent timeout, so this can't be the reason since only the Bot Manager is losing connection, clients have no problem :(. I already changed the bot manager behavior so it creates a new connection if it got disconnected, and only self destroys if only the room to which he is supposed to connect no longer exists. But this is not supposed to be the correct way to deal the problem, during this night the every bot manager reconnected hundreds of times )))
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 21 Mar 2017, 14:31

SmartFoxServer never disconnects anyone unless they are idle, and when it does it says it very clearly in the logs.
Other than that, any other disconnection is not caused by SmartFoxServer. Never ever.

The fact that you're experiencing sudden disconnections on a local network already raises multiple red flags, suggesting there might be some firewall or system configuration that is causing the problem. I would probably bet on the former.

On a clean system you can startup a connection (e.g. via the AdminTool) and come back 20 (or 200) days later with the connection still running.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 21 Mar 2017, 23:39

Thanks!

Is there a way to get the disconnection reason from both client and server side? It is clearly my fault that only this specific user gets disconnected from server so I have to track down the reason.

Thanks again :)
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 22 Mar 2017, 08:43

Yes. Keep in mind that if this is a network issue (which is highly likely) the disconnection error will simply be "unknown", meaning that something external has caused it.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 22 Mar 2017, 09:54

Sooooo how to track the disconnection reason message? Also I can't find all the parameter names for BaseEvent parameter for client (C#) event handlers.

Thanks.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby Lapo » 22 Mar 2017, 10:54

The disconnection message is included when a disconnection reason is known, otherwise it isn't.

Also I can't find all the parameter names for BaseEvent parameter for client (C#) event handlers.

You find the param names under the SFSEvent class. Each event is documented with all the params passed.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
TryMyGames
Posts: 59
Joined: 19 Dec 2016, 22:20
Location: Moldova, Chisinau
Contact:

Re: WHAT DOES THIS SOCKETWRITER ERROR MEAN?

Postby TryMyGames » 22 Mar 2017, 15:27

Finally I found the parameters keys for BaseEvent.

But the problem with Bot Manager disconnection is still not solved :(, I believe that the issue is hidden somewhere in my code, because it doesn't matter on which machine the server is running, and which connection is using (LAN or via Internet) this particular user gets disconnected.

Anyway thanks for help, I will try to find the reason by myself ;)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 76 guests