Ban Management

Ban Management

193k Downloads

Error to Initialize Plugin

bigbluu722 opened this issue ยท 11 comments

commented

Issue report

Tell us about your environment Server based on Arch Linux, running 4 different servers on a bungeecord, all are in offline mode.

  • Server Software: Paperclip Spigot

  • Server Version: 1186[paperclip vers.], (MC: 1.12.1)

  • BanManager Version: BanManager v5.15.0-SNAPSHOT

  • Online/Offline mode: offline

  • Bungeecoord online/offline mode (if applicable): offline

BanManager config.yml:

# 
# Aliases will be found and blocked automatically, e.g. msg will block tell
debug: false
databases:
  local:
    enabled: true
    host: (mask)
    port: (mask)
    name: (mask)
    user: (mask)
    password: (mask)
    maxConnections: 10
    useSSL: false
    verifyServerCertificate: false
    leakDetection: 3000
    tables:
      players: bm_players
      playerBans: bm_player_bans
      playerBanRecords: bm_player_ban_records
      playerMutes: bm_player_mutes
      playerMuteRecords: bm_player_mute_records
      playerKicks: bm_player_kicks
      playerNotes: bm_player_notes
      playerHistory: bm_player_history
      playerReports: bm_player_reports
      playerReportLocations: bm_player_report_locations
      playerReportStates: bm_player_report_states
      playerReportCommands: bm_player_report_commands
      playerReportComments: bm_player_report_comments
      playerWarnings: bm_player_warnings
      ipBans: bm_ip_bans
      ipBanRecords: bm_ip_ban_records
      ipMutes: bm_ip_mutes
      ipMuteRecords: bm_ip_mute_records
      ipRangeBans: bm_ip_range_bans
      ipRangeBanRecords: bm_ip_range_ban_records
      rollbacks: bm_rollbacks
      nameBans: bm_name_bans
      nameBanRecords: bm_name_ban_records
  global:
    enabled: false
    host: (mask)
    port: (mask)
    name: (mask)
    user: (mask)
    password: (mask)
    maxConnections: 10
    useSSL: false
    verifyServerCertificate: false
    leakDetection: 3000
    tables:
      playerBans: bm_player_ban_all
      playerUnbans: bm_player_unban_all
      playerMutes: bm_player_mute_all
      playerUnmutes: bm_player_unmute_all
      playerNotes: bm_player_note_all
      ipBans: bm_ip_ban_all
      ipUnbans: bm_ip_unban_all
mutedCommandBlacklist:
- msg
softMutedCommandBlacklist:
- msg
duplicateIpCheck: true
bypassDuplicateChecks:
- 0.0.0.0
- 127.0.0.1
logKicks: false
logIps: true
displayNotifications: true
broadcastOnSync: false
timeLimits: {}
reportCooldown: 10
warningCooldown: 10
warningActions:
  enabled: false
warningMute: false
hooks:
  enabled: false
checkForUpdates: true
offlineAutoComplete: true
punishAlts: false
denyAlts: false
cleanUp:
  kicks: 30
  banRecords: 0
  ipBanRecords: 0
  ipMuteRecords: 0
  muteRecords: 0
  readWarnings: 0
  unreadWarnings: 0
maxOnlinePerIp: 0
maxMultiaccountsRecently: 0
multiaccountsTime: 300
checkOnJoin: false
createNoteReasons: false
onlineMode: false
chatPriority: normal

Describe your issue:
The plugin seems to fail to intialize every time with the same error on 3 of our 4 servers. Error is here.

[12:51:27] [Server thread/WARN]: 73 [Server thread] INFO me.confuser.banmanager.internal.hikari.HikariDataSource - bm-local - Started.

[12:51:27] [Server thread/WARN]: [AutoSaveWorld] Plugin BanManager attempted to establish connection socket:(mask)in main server thread
[12:51:27] [Server thread/INFO]: [BanManager] Loaded 0 bans into memory
[12:51:27] [Server thread/INFO]: [BanManager] Loaded 0 mutes into memory
[12:51:28] [Server thread/INFO]: [BanManager] Loaded 0 ip bans into memory
[12:51:28] [Server thread/INFO]: [BanManager] Loaded 0 ip mutes into memory
[12:51:28] [Server thread/INFO]: [BanManager] Loaded 0 ip range bans into memory
[12:51:28] [Server thread/INFO]: [BanManager] Loaded 0 name bans into memory
[12:51:28] [Server thread/ERROR]: Error occurred while enabling BanManager v5.15.0-SNAPSHOT (Is it up to date?)
java.lang.NumberFormatException: For input string: "0.0"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_144]
	at java.lang.Long.parseLong(Long.java:589) ~[?:1.8.0_144]
	at java.lang.Long.parseLong(Long.java:631) ~[?:1.8.0_144]
	at me.confuser.banmanager.util.DateUtils.findTimeDiff(DateUtils.java:180) ~[?:?]
	at me.confuser.banmanager.BanManager.onEnable(BanManager.java:144) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.12.1.jar:git-Paper-1186]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316) [patched_1.12.1.jar:git-Paper-1186]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [patched_1.12.1.jar:git-Paper-1186]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:382) [patched_1.12.1.jar:git-Paper-1186]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:331) [patched_1.12.1.jar:git-Paper-1186]
	at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:442) [patched_1.12.1.jar:git-Paper-1186]
	at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:403) [patched_1.12.1.jar:git-Paper-1186]
	at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:341) [patched_1.12.1.jar:git-Paper-1186]
	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:290) [patched_1.12.1.jar:git-Paper-1186]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) [patched_1.12.1.jar:git-Paper-1186]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
[12:51:28] [Server thread/INFO]: [BanManager] Disabling BanManager v5.15.0-SNAPSHOT```

**How to replicate:** 
Applies every restart on 3 of our 4 servers.  Plugin will not initialize correctly on any but one. 
 
**Further information:**
<!--- Anything what you want to tell us that did not fit above can be put here -->
 
commented

That's unusual. What version of MySQL are you running?

Can you paste the output of the following query please?

SELECT UNIX_TIMESTAMP() - 1502700203 as mysqlTime from bm_players
commented
ime from bm_players;
+-----------+
| mysqlTime |
+-----------+
|    340078 |
|    340078 |
|    340078 |
|    340078 |
|    340078 |
|    340078 |
+-----------+
6 rows in set (0.00 sec)

Sent from my Verizon SM-G928V using FastHub

commented

Sql version:
mysql Ver 15.1 Distrib 10.1.25-MariaDB, for Linux (x86_64) using radline 5.1

Sent from my Verizon SM-G928V using FastHub

commented

Honestly, not seen this before, ever. For some reason the query is returning 0.0 which seems odd given that when ran against the database itself it's not reproducible. Just for sanity sake, could you try with normal Spigot instead of Paperclip, and see if the issue still occurs?

commented

Any updates on this issue? Don't want to have to let this small thing persuade me to use another global banning/warn plugin

commented

Tested it on a spigot server with a new database and it had enabled everything on the first fresh run, then after it seemed to not want to connect to the database at all, even though it did fine on the 1st run as it created tables and everything.

[07:09:54] [Server thread/WARN]: 62 [Server thread] INFO me.confuser.banmanager.internal.hikari.HikariDataSource - bm-local - Started.

[07:10:12] [Server thread/WARN]: 18358 [Server thread] INFO me.confuser.banmanager.internal.hikari.pool.HikariPool - bm-local - Close initiated...

[07:10:12] [Server thread/WARN]: 18360 [Server thread] INFO me.confuser.banmanager.internal.hikari.pool.HikariPool - bm-local - Closed.

[07:10:12] [Server thread/ERROR]: Error occurred while enabling BanManager v5.15.0-SNAPSHOT (Is it up to date?)
me.confuser.banmanager.internal.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 10 times. Giving up.
	at me.confuser.banmanager.internal.hikari.pool.HikariPool.checkFailFast(HikariPool.java:516) ~[?:?]
	at me.confuser.banmanager.internal.hikari.pool.HikariPool.<init>(HikariPool.java:118) ~[?:?]
	at me.confuser.banmanager.internal.hikari.HikariDataSource.getConnection(HikariDataSource.java:94) ~[?:?]
	at me.confuser.banmanager.internal.ormlite.jdbc.DataSourceConnectionSource.getReadWriteConnection(DataSourceConnectionSource.java:120) ~[?:?]
	at me.confuser.banmanager.internal.ormlite.jdbc.DataSourceConnectionSource.getReadOnlyConnection(DataSourceConnectionSource.java:102) ~[?:?]
	at me.confuser.banmanager.internal.ormlite.dao.BaseDaoImpl.isTableExists(BaseDaoImpl.java:689) ~[?:?]
	at me.confuser.banmanager.storage.PlayerStorage.<init>(PlayerStorage.java:41) ~[?:?]
	at me.confuser.banmanager.BanManager.setupStorages(BanManager.java:340) ~[?:?]
	at me.confuser.banmanager.BanManager.onEnable(BanManager.java:135) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:402) [spigot.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:384) [spigot.jar:git-Spigot-da42974-8f47214]
	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:333) [spigot.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:422) [spigot.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:383) [spigot.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:338) [spigot.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:272) [spigot.jar:git-Spigot-da42974-8f47214]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot.jar:git-Spigot-da42974-8f47214]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 10 times. Giving up.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2104) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2029) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at me.confuser.banmanager.internal.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95) ~[?:?]
	at me.confuser.banmanager.internal.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101) ~[?:?]
	at me.confuser.banmanager.internal.hikari.pool.PoolBase.newConnection(PoolBase.java:316) ~[?:?]
	at me.confuser.banmanager.internal.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) ~[?:?]
	... 19 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2198) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2045) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2029) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) ~[spigot.jar:git-Spigot-da42974-8f47214]
	at me.confuser.banmanager.internal.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95) ~[?:?]
	at me.confuser.banmanager.internal.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101) ~[?:?]
	at me.confuser.banmanager.internal.hikari.pool.PoolBase.newConnection(PoolBase.java:316) ~[?:?]
	at me.confuser.banmanager.internal.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) ~[?:?]
	... 19 more
[07:10:12] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[07:10:12] [Server thread/INFO]: Done (23.171s)! For help, type "help" or "?"
[07:10:12] [Server thread/INFO]: [BanManager] The following commands are blocked whilst muted:
[07:10:12] [Server thread/INFO]: [BanManager] msg
[07:10:12] [Server thread/INFO]: [BanManager] The following commands are blocked whilst soft muted:
[07:10:12] [Server thread/INFO]: [BanManager] msg```

Would like to note that it seemed to be "enabled" when it wasn't due to the last few lines.
-V
commented

Just to get this right: You edited your config to fit your MySQL credentials, restarted, let BanManager create all the tables and worked well, then restarted again and it cannot connect to the database anymore. Is this correct?

commented

Yes, this is correct. It had ran fine the first instance, then couldn't seem to connect after a restart. I tried to use the old database and it seemed to do the same thing rather than give the 0.0 error after it connected to the database.
-V

commented
commented

Have tested this fix and it has fixed my issue and the plugin is usable again. Thanks for the find!
-V

commented

We do run luckperms as well, so I'll try the suggested fix in that post to see if that solves our issue, thanks.