CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

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

Moderators: Lapo, Bax

votagusvotag
Posts: 38
Joined: 07 Nov 2016, 12:26

CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby votagusvotag » 17 May 2018, 15:04

Hi, we have this problem where random peaks would appear and at this point our only suspect is this log:
17 May 2018 | 14:58:03,086 | WARN | SFSWorker:Ext:18 | controllers.v290.ExtensionReqController | | com.smartfoxserver.v2.exceptions.SFSExtensionException: User cannot invoke Room extension if he's not joined in that Room. ( User Name: Risebata, Id: 0, Priv: 1, Sess: 190.104.176.248:16394 ) , [ Room: 1526568921157, Id: 27, Group: games, isGame: true ]
com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:145)
com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

How can we know when a user is trying to do that and how to stop it?
We used to have peaks before due to poorly management of db connections, but that's fixed already.

Also how do we stop this from being logged?
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling New Packet of size 388
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling Header Size. Length: 387 (small)
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Data size is 385
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling Data: 385, previous state: 0/385
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | <<< Packet Complete >>>

It is from a server side client, but all debug are set to false:

Code: Select all

sfs = new SmartFox(false);
...
cfg.setDebug(false);

Check the log file starting from line 4385.

Thanks.

SFS version : 2.13.0
C# api version: 1.7.5
Attachments
error.rar
Logs.
(29.41 KiB) Downloaded 483 times
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby Lapo » 17 May 2018, 16:39

votagusvotag wrote:Hi, we have this problem where random peaks would appear and at this point our only suspect is this log:
17 May 2018 | 14:58:03,086 | WARN | SFSWorker:Ext:18 | controllers.v290.ExtensionReqController | | com.smartfoxserver.v2.exceptions.SFSExtensionException: User cannot invoke Room extension if he's not joined in that Room. ( User Name: Risebata, Id: 0, Priv: 1, Sess: 190.104.176.248:16394 ) , [ Room: 1526568921157, Id: 27, Group: games, isGame: true ]
com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:145)
com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

How can we know when a user is trying to do that and how to stop it?

What do you mean by "random peaks". Like spikes of CPU usage?
Do you have a screenshot of these spikes? Have you checked if the spikes correlate with maybe spikes in the traffic or server queue activity?
Sometimes they line up very clearly.

As regards the exception above, it's unlikely this is the cause of big spikes but if happens very often it could suggest that you're not handling the join errors correctly.
The error is due to a client invoking an Room Extension command without being actually joined in that Room. I would make sure that on the client side you allow clients to call the Room Extension only if they have joined that Room.

Also how do we stop this from being logged?
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling New Packet of size 388
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling Header Size. Length: 387 (small)
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Data size is 385
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | Handling Data: 385, previous state: 0/385
17 May 2018 | 12:58:10,422 | INFO | New I/O client worker #1-1 | client.core.SFSIOHandler | | <<< Packet Complete >>>

It is from a server side client, but all debug are set to false:

Code: Select all

sfs = new SmartFox(false);
...
cfg.setDebug(false);

So you're running a client inside the server that connects back to the server?
In any case, the logging issue you're describing use to exist in older releases of the Java API. I'd suggest to update to the latest release.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
votagusvotag
Posts: 38
Joined: 07 Nov 2016, 12:26

Re: CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby votagusvotag » 17 May 2018, 17:53

What do you mean by "random peaks". Like spikes of CPU usage?
Do you have a screenshot of these spikes? Have you checked if the spikes correlate with maybe spikes in the traffic or server queue activity?
Sometimes they line up very clearly.

Sometimes CPU with network, but others just network peaks, in any case I do check if the user is still joined in the room this way:

Code: Select all

        private Room BattleRoom
        {
            get
            {
                return Connection.JoinedRooms.Where(r => r.IsGame).FirstOrDefault();
            }
        }

And I won't send the request if the room is null, so maybe there is a desynchronization with the server. Is there a way know what cmd was trying to send the client? That way I could guess better the code that is being executed in the client.

I attached a peak from this morning, we currently have less than 100 CCU so it has to be a problem within our code.
Attachments
queue.JPG
During the peak.
(121.38 KiB) Not downloaded yet
peak.png
Peak.
(111.33 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby Lapo » 18 May 2018, 07:05

Hi,
peaks don't look too bad or too frequent. In the screenshot the latest peak is definitely linked to the spike in outgoing traffic below.
In any case for only 100 CCU it shouldn't happen.

If you have a dev version of your server (with the same Extensions) you could run 100 simulated clients and see if you can reproduce it. If you can then you can use VIsualVM to investigate the problem in more details.

To create a stress test you can read this article:
https://smartfoxserver.com/blog/buildin ... test-tool/

To use VisualVM see here:
http://docs2x.smartfoxserver.com/Advanc ... ive-server

In the article you can skip the steps to reconfigure SFS2X, if you run VIsualVM and SFS2X on the same machine.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Black
Posts: 6
Joined: 09 Jan 2020, 10:43

Re: CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby Black » 24 Mar 2020, 18:00

I have same issues, @votagusvotag how do you solved it?

Code: Select all

24 Mar 2020 | 14:46:34,109 | WARN  | SFSWorker:Sys:15 | controllers.v290.SystemReqController |     | com.smartfoxserver.v2.exceptions.SFSRuntimeException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: LeaveRoom failed: user is not joined in any room. ( User Name: 42_35638ce3-ef1f-4588-86fd-bd4725438dd3, Id: 6399, Priv: 0, Sess: 10.20.1.5:38521 )
Description: Runtime error while processing request
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.api.SFSApi.leaveRoom(SFSApi.java:1044)
com.smartfoxserver.v2.controllers.system.LeaveRoom.execute(LeaveRoom.java:47)
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)

I have much error and server respond very slow when run in 15h :(
Attachments
Screen Shot 2020-03-25 at 12.57.00 AM.png
(71.32 KiB) Not downloaded yet
Screen Shot 2020-03-25 at 12.55.20 AM.png
(223.7 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU/network peaks after lots of "User cannot invoke Room extension if he's not joined in that Room."

Postby Lapo » 24 Mar 2020, 20:29

Hi,
from the screenshot your Extension queue is constantly full which is indication that something in your code is holding each thread for a too long time. Please start a new thread and explain exactly what your server side code does.

Usually these problems are caused by HTTP calls made to remote servers, which creates performance bottlenecks.

Let us know the details.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 50 guests