Banning users by IP bug

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Banning users by IP bug

Post by marsoups »

There seems to be a bug with banning users on our site by IP address. For some reason, on our live site, it triggers an error message in the logs when banning by IP.

However, on development / staging servers, the functionality works as expected.

There are at least 1800 banned users in our ban list, and unfortunately due to the nature of our clients' needs, this number of bans is necessary. Banning by username works fine, however ban by ip, does not.

Anybody know what's causing this ? Here is the log :

Code: Select all

INFO   | jvm 1    | 2011/09/01 05:36:08 | Error: java.lang.NullPointerException
INFO   | jvm 1    | 2011/09/01 05:36:08 | Handler: it.gotoandplay.smartfoxserver.tasks.BanUserTaskHandler@4c5d143a
INFO   | jvm 1    | 2011/09/01 05:36:08 | java.lang.NullPointerException
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at it.gotoandplay.smartfoxserver.SmartFoxServer.addBannedUser(SmartFoxServer.java:2683)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at it.gotoandplay.smartfoxserver.tasks.BanUserTaskHandler.doTask(BanUserTaskHandler.java:47)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at it.gotoandplay.smartfoxserver.util.scheduling.Scheduler.executeTasks(Scheduler.java:314)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at it.gotoandplay.smartfoxserver.util.scheduling.Scheduler.run(Scheduler.java:223)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO   | jvm 1    | 2011/09/01 05:36:08 |       at java.lang.Thread.run(Unknown Source)
This is the code that executes the ban (the message is tailored on clientside due to multilingual capability):

Code: Select all

_server.banUser(u, 0, "#ERR3", _server.BAN_BY_IP);
Would be great if this can be resolved soon. Thanks.
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Just wondering.. is AntiFlood or BadWordFilter enabled? If so, what's their <BanAfter> configuration?

Furthermore, you said that it works on development server. What is your ban list like on the development server? Does it contain any users? Or is it empty?

Are you able to view the list of all banned IP address via Ban Manager via AdminTool?
Smartfox's forum is my daily newspaper.
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Post by marsoups »

BigFIsh wrote:Just wondering.. is AntiFlood or BadWordFilter enabled? If so, what's their <BanAfter> configuration?

Furthermore, you said that it works on development server. What is your ban list like on the development server? Does it contain any users? Or is it empty?

Are you able to view the list of all banned IP address via Ban Manager via AdminTool?
Cheers for the response bigFish.

Antiflood is enabled , here is config for that :

Code: Select all

<AntiFlood active="true">
			<MinMsgTime tolerance="5">1000</MinMsgTime>
			<MaxRepeatedMessages>3</MaxRepeatedMessages>
			<WarningsBeforeKick>2</WarningsBeforeKick>
			<WarningMessage><![CDATA[#ERR4]]></WarningMessage>
			<KickMessage><![CDATA[#ERR5]]></KickMessage>
			<BanMessage><![CDATA[#ERR6]]></BanMessage>			
			<BanAfter timeSpan="1">3</BanAfter>
		</AntiFlood>
The ban list, viewed in the admin tool has a vast number of banned usernames, however no banned IP's are listed as somehow the ban IP function is not working at all and it triggers that message in the first post every time.

So I do have a custom function within the extension containing a list of banned IP's to get around this issue, which checks the IP in the custom login phase, but it would be helpful to enter these IP's into the Smartfox configuration as well, so the ban IP function can be harnessed and the ban by IP function works without having to use the kick or ban by username function to get around it and force the target user off the site.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Does the error happen systematically on each attempt? Or is it a sporadic occurrence? We are not able to reproduce this locally at the moment
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Post by marsoups »

Yes it is systematic.

It could be related to a huge number of usernames in the banlist already, as this only occurs on the live site and not our staging sites..

Every time smartfox is restarted, it reloads the banlist from the database and this repopulates the username banlist via offline bans. However it's impossible to add banned IP's unless the user at the IP address is online at the time, though IP bans appears to stop working when there is a vast quantity of users online or vast quantity of banned usernames.

If there is any patch you'd like us to apply for debugging this, please let me know.
Post Reply