DevLeoko / AdvancedBan

AdvancedBan is a Spigot plugin to manage punishments on single servers and server networks
GNU General Public License v3.0
156 stars 128 forks source link

At some point, a player will be banned twice at the same time #593

Open KOFTWAR opened 1 year ago

KOFTWAR commented 1 year ago

Sorry about my English,Because it's not my mother tongue

What version of AdvancedBan (/AdvancedBan) are you using? 2.3.0 Latest

What kind of server do you have (Bungeecord/single server)? single server

What server version (/version) are you using? 1.8.8-PaperSpigot-445

Please provide the EXACT steps required to reproduce the problem... I can't exactly reproduce the problem because it occurs so randomly Using anti-cheat plugins to banned player will greatly increase the probability of triggering the problem

Any error/log post it through pastebin.com and link it here. (Also include /plugins/AdvancedBan/logs/latest.log) There is no log file

Add any additional information below. When I use the anti-cheat plugin to ban players, sometimes it happens that a player is banned twice. This problem hardly occurs under normal circumstances and no error is reported. I'm submitting this Issue to let you know that the problem exists, even though it doesn't really matter if you fix it or not And sorry about my English,Because it's not my mother tongue

Hopefuls commented 1 year ago

Could you elaborate the behaviour of "banning twice"? do you see multiple messages of the user being banned?

KOFTWAR commented 1 year ago

Could you elaborate the behaviour of "banning twice"? do you see multiple messages of the user being banned?

In the banlist there are two players banned information When I want to unban a player I need to type /unban twice

KOFTWAR commented 1 year ago

屏幕截图 2022-12-02 154114 屏幕截图 2022-12-02 154056 well,just like this

KOFTWAR commented 1 year ago

There are multiple player banned information in the banlist

KOFTWAR commented 1 year ago

This player can be banned up to five times.... I can also ban the player once by entering the command

KOFTWAR commented 1 year ago

1345

Hopefuls commented 1 year ago

if the timestamps on both of these bans are equal, there is a small chance that it will accept both bans.

unsure about a fix as of now though, apart from having your anticheat only trigger once and not repeatedly

A248 commented 1 year ago

Actually, this is a bug in AdvancedBan. The check for whether a player is already banned is not resilient enough to handle concurrent execution. So, although it's usually impossible to ban someone twice in AdvancedBan, running the command quickly enough allows you to bypass the check for an existing ban.

A248 commented 1 year ago

The solution to this on AdvancedBan's side would be to use a database transaction and a sufficiently high transaction isolation level. That way, the check for the existing ban is atomic with respect to the new ban's addition.