smartfox stops accepting connections/requests

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

Moderators: Lapo, Bax

sebako
Posts: 20
Joined: 22 Jan 2011, 02:06
Location: Ireland
Contact:

smartfox stops accepting connections/requests

Postby sebako » 04 Jun 2011, 15:39

Hey guys,

I got a bit of trouble here. I have setup my smartfox on a CentOS machine and try to access it using unity webplayer / editor which works fine. However after a few hours of beeing idle or ~20 logins in a row, smartfox stops accepting any requests and the login will fail. After restarting the smartfox server, everything works again and the thing begins again, a few hours of beeing idle or ~20 logins in a row and it will fail :(
Does anyone have an idea what may cause the issue or how to track it? I cannot see anything useful in the logs of the server.

If you need any further information please let me know and I will provide them.

Thanks in advance

Cheers
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 04 Jun 2011, 22:14

hi. It could be because of the database access. Have you read Lapo.s sticky about connection issues?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
sebako
Posts: 20
Joined: 22 Jan 2011, 02:06
Location: Ireland
Contact:

Postby sebako » 04 Jun 2011, 22:30

I have just read it now, I will try to play with it, unfortunately it won't even let me login to the admin panel when the issue occurs, so doesn't seem to be related to it.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 04 Jun 2011, 22:46

hum.. Sorry never had this problem, so i cant help much further. But there are some topics about this problem, maybe they can help
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
jurekf
Posts: 69
Joined: 08 Dec 2010, 23:46

Postby jurekf » 05 Jun 2011, 14:06

I'm guessing you're not using SFS 2.x?

SFS 1.x trial only allows up to 20 concurrent users IIRC. It's possible your other logins aren't being cleared up and you're hitting this limit. Normally this throws an exception and should be appearing in your logs.
rafaels
Posts: 11
Joined: 04 May 2011, 12:29
Contact:

I have the exact same problem

Postby rafaels » 08 Jun 2011, 13:17

Hello,

My server does exactly the same. It even sends messages to clients successfully but it does not react to any incoming client requests, including login (even from the admin tool).

If you have found the problem please let me know.

Thank you!
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Postby falcan » 13 Jun 2011, 23:03

Same issue here, client complains that the login suddently stopped working(after few days), I don't know yet if it's an issue in my Java extensions doing something bad. I don't believe it's database related as admin panel login doesn't work as well...if I try to login from inside Flash IDE, this is where I get:

Connecting to SmartFox2...
Config load success!
Server settings: BLABLA_IP:9933
[SFS - INFO] Object going out:
(short) a: 0
(sfs_object) p:
(utf_string) api: 0.9.9
(utf_string) cl: FlashPlayer:External:WIN 10,1,52,14

(byte) c: 0

[SFS - INFO] Data written: Binary Size: 75
12 00 03 00 01 61 03 00 00 00 01 70 12 00 02 00 .....a.....p....
03 61 70 69 08 00 05 30 2E 39 2E 39 00 02 63 6C .api...0.9.9..cl
08 00 23 46 6C 61 73 68 50 6C 61 79 65 72 3A 45 ..#FlashPlayer:E
78 74 65 72 6E 61 6C 3A 57 49 4E 20 31 30 2C 31 xternal:WIN.10,1
2C 35 32 2C 31 34 00 01 63 02 00 ,52,14..c..

[SFS - INFO] Data Read: Binary Size: 80
80 00 4D 12 00 03 00 01 61 03 00 00 00 01 63 02 ..M.....a.....c.
00 00 01 70 12 00 03 00 02 74 6B 08 00 20 31 32 ...p.....tk...12
65 33 33 66 30 30 64 34 63 63 31 33 35 34 31 36 e33f00d4cc135416
33 36 37 37 34 64 64 65 64 34 66 64 63 62 00 02 36774dded4fdcb..
63 74 04 00 00 04 00 00 02 6D 73 04 00 7A 12 00 ct.......ms..z..

[SFS - INFO] Handshake { Message id: 0 }
{ Dump: }

(int) ms: 8000000
(utf_string) tk: 12e33f00d4cc13541636774dded4fdcb
(int) ct: 1024

Connected!
[SFS - INFO] Object going out:
(short) a: 1
(sfs_object) p:
(utf_string) pw: dd71ba6fbc42124115f027f9587fa322
(utf_string) un: pavel
(utf_string) zn: SimpleChat

(byte) c: 0

[SFS - INFO] Data written: Binary Size: 88
12 00 03 00 01 61 03 00 01 00 01 70 12 00 03 00 .....a.....p....
02 70 77 08 00 20 64 64 37 31 62 61 36 66 62 63 .pw...dd71ba6fbc
34 32 31 32 34 31 31 35 66 30 32 37 66 39 35 38 42124115f027f958
37 66 61 33 32 32 00 02 75 6E 08 00 05 70 61 76 7fa322..un...pav
65 6C 00 02 7A 6E 08 00 0A 53 69 6D 70 6C 65 43 el..zn...SimpleC
68 61 74 00 01 63 02 00 hat..c..


----------- This is where it stops ------------------

And after a long time:

Connection lost
due to unknown reason<br>Please check the server-side log

In the error logs I see no errors. I'm seeing just lots of this:

14 Jun 2011 00:54:06,250 INFO [SocketReader] bitswarm.core.SocketAcceptor - Session created: { Id: 201, Type: DEFAULT, Logged: No, IP: 127.0.0.1:3489 } on Server port: 9933 <---> 3489
14 Jun 2011 00:54:06,250 INFO [com.smartfoxserver.v2.controllers.SystemController-1] v2.controllers.SystemController - {IN}: Handshake
14 Jun 2011 00:54:06,250 INFO [com.smartfoxserver.v2.controllers.SystemController-1] v2.controllers.SystemController - {IN}: Login
14 Jun 2011 00:58:58,609 INFO [Scheduler1-thread-1] bitswarm.sessions.DefaultSessionManager - Session removed: { Id: 200, Type: DEFAULT, Logged: No, IP: 86.49.77.149:63324 }

After restart the customer says it was ok in the last case - now he didn't restart so I could see it. I still believe it's my fault but would like to know what could prevent an admin login?
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Any updates?

Postby falcan » 27 Jun 2011, 03:52

Any updates on this? I'd like to hear at least a theory. I've read the sticky note about connections but I don't think it applies if you can't login even to admin tool - does it? My customer has to restart SFX almost every day to keep it working...would really appreciate answer from Lapo or someone :) Thanks!
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Postby falcan » 08 Jul 2011, 20:39

Bouncing this again - I've also noticed when trying to login from admin this is in the admin log:

[23:27:44 | INFO] Connected to XXXXXXXX.com:9933; now performing login
[23:26:43 | WARNING] A disconnection occurred due to unknown reason; please reconnect

Happens each time I try to login, so I guess it can't be something with extensions. Anyone else with the problem found a solution? I have worked with SFX1 in the past and never had this problem before...but with SFX2 I have no clue. :?
jurekf
Posts: 69
Joined: 08 Dec 2010, 23:46

Postby jurekf » 09 Jul 2011, 02:06

We're seeing getConnection hanging in some rare cases. Is it possible that your login thread is also stalled on a getConnection call?
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Postby falcan » 12 Jul 2011, 12:08

A thread is definetly stalled..in the logs I see nothing ever catches the login(even in the first few hours it does) - I don't know the internal SFX structure too well, but I just need to know, if it is possible that something in my extension can mess up (after few hours) the general SFX login, even to control panel?

Bad thing is I get no error reports so I'm just guessing where the issue is. Can't also login to admin panel... Can it be database related/related to my custom login extension? I'm just looking for a theory/confirmation of what could cause this thing to crash all the logins...I'm kind of new to Java, before when I developed with SFX1(I'm a SFX1 customer) never had this kind of problem before. Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 13 Jul 2011, 06:10

You really need to check your threading.
A few steps:

1) Monitor your threads via jconsole or visualvm, check if they get stuck
2) Adjust the thread pools so that you have plenty of workers to deal with the database
3) Test the timings of each query you run from server side and make sure it runs in a decent amount of time. Eg: < 20-30ms ... OK, >50-100ms... try to optimize

Take multiple tests, not just one as the JVM needs to "warm up" (Activate the JIT compiler and optimizations)

Adjusting the thread pools:
http://docs2x.smartfoxserver.com/Advanc ... hreadModel

There are two thread pools to consider:
EventManager: responsible of firing events to your extensions
ExtensionController: responsible of handling client calls to your server code

If you use a DB just logging in then you can just resize the former otherwise you can fine tune both.

Start low. 4-16 threads and see how much it helps.
If your traffic is in the 1000s of CCU you might need higher settings

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 13 Jul 2011, 06:35

Problem may concern database. Maybe we had the same issue. Check this topic.
viewtopic.php?t=11076&highlight=
As far as I know in SFS database examples database connections are not closed. When their number reach limit queries are rejected.
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Postby falcan » 13 Jul 2011, 14:32

Hi Lapo, thanks for the reply! Just one important thing to note - the server we are using has very low traffic because it's just starting out (most people playing at the same time were 8 :). So I'm not sure if threads could be still the issue.
But thanks for the thread monitoring hint, I'll check it out!
falcan
Posts: 44
Joined: 04 Mar 2009, 12:55

Postby falcan » 13 Jul 2011, 14:37

COB wrote:Problem may concern database. Maybe we had the same issue. Check this topic.
viewtopic.php?t=11076&highlight=
As far as I know in SFS database examples database connections are not closed. When their number reach limit queries are rejected.


Thanks, going to check it out...I saw couple of details at times being wrong in the docs (even in SFX1) and it took me sometimes few hours to figure out so it's possible I've copied errornous code again :P

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 48 guests