We had some issues trying to setup the flood filter, so I've done some testing and seem to have some issues with getting the flood filter working properly.
I've attached a picture of our flood filter settings for testing, where I've set a limit of 12 per second for public messages and 12 per second for SetUserVariables. The filter seems to work properly for public messages (though I haven't tested significantly).
I am using the stress test code here: https://smartfoxserver.com/blog/buildin ... test-tool/ , but changing the public message send to the following:
Code: Select all
double randomAction = rand.nextDouble();
userVars.clear();
userVars.add(new SFSUserVariable("x", randomAction));
pubMessageCount++;
sfs.send(new SetUserVariablesRequest(userVars));
to test the same code with user variables. I've attached this code below and settings used but it should be effectively the same as your stress testing code.
Despite the 12 message per second limit of the filter, any setting for sending messages more frequently than 1 user variable set every 999 milliseconds seems to cause the following exception:
Code: Select all
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: Flooding error
Description: Runtime error while processing request
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.controllers.BaseControllerCommand.checkRequestPermissions(BaseControllerCommand.java:166)
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)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
It seems almost always reproducible at 998 milliseconds and always reproducible at 997. But obviously these rates are far below 12 messages per second (83 milliseconds) for expected flood filter issues.
Am I missing something obvious here or is there some other behavior with using the flood filter on user variable updates? For these tests I am running a default 2.17.0 SFS server with no extension selected, let me know if you need any more info.