WiIIiam278 / HuskHomes

The powerful & intuitive homes, warps, and teleportation suite
https://william278.net/project/huskhomes
Apache License 2.0
127 stars 82 forks source link

Player home lost #658

Closed buildin1 closed 3 months ago

buildin1 commented 4 months ago

It has been tested and found that there is a probability of player data loss when using SQLite and MySQL. Even if the server is shut down normally, sometimes user data cannot be saved properly. Currently, the latest version of Huskhome is being used, and this problem is very serious. Many server owners have encountered related issues, and feedback from players has affected the gaming experience

WiIIiam278 commented 4 months ago

Please provide details on how to reproduce and your setup if this is something you've experienced; if you have specific reproduction steps I'm able to look into this of course but "many server owners" is too vague and not actionable

hseermc commented 4 months ago

I'm running into this bug. it is very severe. all the players in my server lost their home when server restart or they Re-entry my server. They lost all the homes without the home which they first set.(sorry my poor English, i use bing translate Is it okay to fix it as soon as possible?

2534905003 commented 4 months ago

I also encountered this problem and hope to solve it soon, after solving it, I can use Alipay or PayPal to support you

CodeZhangBorui commented 3 months ago

The same problem occurs here.

By checking the database, I found that the last location data was saved at 2024/8/16 19:49:52. I performed a server restart task at 2024/8/18 20:30:00, and all the saved data was lost within nearly 49 hours.

There's an error reported at 2024/8/16 19:51:07 (After the latest positions in the database):

[19:51:07] [Craft Scheduler Thread - 675 - HuskHomes/ERROR]: [HuskHomes] Failed to set the offline position of shuatie
org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (cannot commit transaction - SQL statements in progress)
    at org.sqlite.core.DB.newSQLException(DB.java:1179) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.newSQLException(DB.java:1190) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.throwex(DB.java:1150) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.ensureAutocommit(DB.java:1255) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.lambda$ensureAutoCommit$2(DB.java:1226) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.lambda$ensureAutoCommit$3(DB.java:1225) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.ensureAutoCommit(DB.java:1223) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.execute(DB.java:977) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.core.DB.executeUpdate(DB.java:1054) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$executeLargeUpdate$2(JDBC3PreparedStatement.java:119) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:454) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.jdbc3.JDBC3PreparedStatement.executeLargeUpdate(JDBC3PreparedStatement.java:118) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:100) ~[sqlite-jdbc-3.42.0.0.jar:?]
    at net.william278.huskhomes.database.SqLiteDatabase.updatePosition(SqLiteDatabase.java:177) ~[HuskHomes-Paper-4.7.jar:?]
    at net.william278.huskhomes.database.SqLiteDatabase.setOfflinePosition(SqLiteDatabase.java:893) ~[HuskHomes-Paper-4.7.jar:?]
    at net.william278.huskhomes.listener.EventListener.lambda$handlePlayerLeave$7(EventListener.java:106) ~[HuskHomes-Paper-4.7.jar:?]
    at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.1.jar:git-Purpur-2062]
    at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.20.1.jar:git-Purpur-2062]
    at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.20.1.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

It refers to:

https://github.com/WiIIiam278/HuskHomes/blob/588cc3f9900675393590c0584c302e721e04c218/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java#L177

At that time, two players (actually robots, which we allow) were offline at the same time:

[19:51:07] [Server thread/INFO]: hjfunny520 lost connection: [fakeplayer] Creator offline
[19:51:07] [Server thread/INFO]: shuatie lost connection: [fakeplayer] Creator offline

It is possible that the first player was not finished processing and then the second player was attempted to be processed while the table was locked.

Esacpe-beep commented 3 months ago

ctrl+c ctrl+v lol

roggy666 commented 2 months ago

[08:03:13] [Craft Scheduler Thread - 923 - HuskHomes/ERROR]: [HuskHomes] Failed to set the offline position of CoolMedusa37602 org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (cannot commit transaction - SQL statements in progress) at org.sqlite.core.DB.newSQLException(DB.java:1179) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.newSQLException(DB.java:1190) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.throwex(DB.java:1150) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.ensureAutocommit(DB.java:1255) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.lambda$ensureAutoCommit$2(DB.java:1226) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.lambda$ensureAutoCommit$3(DB.java:1225) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.ensureAutoCommit(DB.java:1223) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.core.DB.execute(DB.java:977) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$executeQuery$1(JDBC3PreparedStatement.java:92) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:454) ~[sqlite-jdbc-3.46.0.0.jar:?] at org.sqlite.jdbc3.JDBC3PreparedStatement.executeQuery(JDBC3PreparedStatement.java:87) ~[sqlite-jdbc-3.46.0.0.jar:?] at HuskHomes-Paper-4.7 (1).jar/net.william278.huskhomes.database.SqLiteDatabase.setOfflinePosition(SqLiteDatabase.java:890) ~[HuskHomes-Paper-4.7 (1).jar:?] at HuskHomes-Paper-4.7 (1).jar/net.william278.huskhomes.listener.EventListener.lambda$handlePlayerLeave$7(EventListener.java:106) ~[HuskHomes-Paper-4.7 (1).jar:?] at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.1.jar:1.21.1-2305-fdfc12e] at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.1.jar:1.21.1-2305-fdfc12e] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-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) ~[?:?]

CodeZhangBorui commented 2 months ago

Problem still occurs here, with HuskHomes-Paper-4.7.1-ab7237f.

[12:31:29 INFO]: LSamoyedy lost connection: Disconnected
[12:31:29 INFO]: - LSamoyedy left the server
[12:41:05 INFO]: LSamoyedy_Bot_1 lost connection: [fakeplayer] Creator offline
[12:41:05 INFO]: - LSamoyedy_Bot_1 left the server
[12:41:05 INFO]: LSamoyedy_Bot_2 lost connection: [fakeplayer] Creator offline
[12:41:05 INFO]: - LSamoyedy_Bot_2 left the server
[12:41:05 INFO]: [fakeplayer] LSamoyedy is offline more than 12000 ticks, removing 2 fake players
[12:41:05 ERROR]: [HuskHomes] Failed to set the offline position of LSamoyedy_Bot_2
org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (cannot commit transaction - SQL statements in progress)
        at org.sqlite.core.DB.newSQLException(DB.java:1179) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.newSQLException(DB.java:1190) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.throwex(DB.java:1150) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.ensureAutocommit(DB.java:1255) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.lambda$ensureAutoCommit$2(DB.java:1226) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.lambda$ensureAutoCommit$3(DB.java:1225) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.SafeStmtPtr.safeRunConsume(SafeStmtPtr.java:142) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.ensureAutoCommit(DB.java:1223) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.execute(DB.java:977) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.core.DB.executeUpdate(DB.java:1054) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$executeLargeUpdate$2(JDBC3PreparedStatement.java:119) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:454) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeLargeUpdate(JDBC3PreparedStatement.java:118) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:100) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at net.william278.huskhomes.database.SqLiteDatabase.updatePosition(SqLiteDatabase.java:178) ~[HuskHomes-Paper-4.7.1-ab7237f.jar:?]
        at net.william278.huskhomes.database.SqLiteDatabase.setOfflinePosition(SqLiteDatabase.java:894) ~[HuskHomes-Paper-4.7.1-ab7237f.jar:?]
        at net.william278.huskhomes.listener.EventListener.lambda$handlePlayerLeave$7(EventListener.java:107) ~[HuskHomes-Paper-4.7.1-ab7237f.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.20.1.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]