Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] UID Purge Issues #32

Open
mdw19873 opened this issue Aug 19, 2024 · 0 comments
Open

[Bug] UID Purge Issues #32

mdw19873 opened this issue Aug 19, 2024 · 0 comments

Comments

@mdw19873
Copy link

mdw19873 commented Aug 19, 2024

While attempting to setup AuxProtect for a new server with a MySQL backend, I encountered two issues I'd like to bring to your attention.

First, during UID Purge, it appears that the query used to execute the purge does not take into account table prefixes. I received the following error:

[WARN]: [AuxProtect] Table '[REDACTED].auxprotect_uids' doesn't exist
java.sql.SQLSyntaxErrorException: Table '[REDACTED].auxprotect_uids' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:112) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:113) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:938) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1106) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1045) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1369) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1030) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturnRows(ConnectionPool.java:323) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.lambda$purgeUIDs$0(SQLManager.java:338) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturnException(ConnectionPool.java:254) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturn(ConnectionPool.java:227) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.purgeUIDs(SQLManager.java:321) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.connect(SQLManager.java:163) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.spigot.AuxProtectSpigot$1.run(AuxProtectSpigot.java:228) ~[AuxProtect-1.3.2.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[paper-1.21.1.jar:1.21.1-38-e4b38b4]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.21.1.jar:1.21.1-38-e4b38b4]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(Server SchedulerReportingWrapper.java:22) ~[paper-1.21.1.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

I believe the offending line of code can be found here.

After deleting the newly created tables and removing the table prefix, I attempted to setup the plugin again with the same MySQL backend. I then encountered the following error:

[WARN]: [AuxProtect] You can't specify target table 'auxprotect_uids' for update in FROM clause
java.sql.SQLException: You can't specify target table 'auxprotect_uids' for update in FROM clause
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:113) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:938) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1106) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1045) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1369) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1030) ~[mysql-connector-j-8.4.0.jar:8.4.0]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturnRows(ConnectionPool.java:323) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.lambda$purgeUIDs$0(SQLManager.java:338) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturnException(ConnectionPool.java:254) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.ConnectionPool.executeReturn(ConnectionPool.java:227) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.purgeUIDs(SQLManager.java:321) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.database.SQLManager.connect(SQLManager.java:163) ~[AuxProtect-1.3.2.jar:?]
at AuxProtect-1.3.2.jar/dev.heliosares.auxprotect.spigot.AuxProtectSpigot$1.run(AuxProtectSpigot.java:228) ~[AuxProtect-1.3.2.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[paper-1.21.1.jar:1.21.1-38-e4b38b4]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.21.1.jar:1.21.1-38-e4b38b4]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.21.1.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

I believe the issue resides in the same line of code above, but is a syntax issue of some sort.

As much as I would have loved to have created a PR myself, my Java skills are severely lacking. Please let me know if there are any other details I can provide.

@mdw19873 mdw19873 changed the title UID Purge Issues [Bug] UID Purge Issues Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant