Iru21 / Authy

A simple authentication plugin for Minecraft 1.17+!
https://modrinth.com/plugin/authy
GNU Lesser General Public License v3.0
25 stars 17 forks source link

Error: The database file is locked(database is locked) #55

Open f1refa11 opened 7 months ago

f1refa11 commented 7 months ago

Error text:

[22:47:28 ERROR]: null                                                                                                                                                                                                                       |
org.bukkit.command.CommandException: Unhandled exception executing command 'register' in plugin Authy v3.5.2
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:987) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.20.1.jar:git-Paper-196]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[paper-1.20.1.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:324) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:308) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2354) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$21(ServerGamePacketListenerImpl.java:2314) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1338) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1315) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1308) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1170) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
        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.execute(DB.java:985) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$execute$0(JDBC3PreparedStatement.java:57) ~[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.execute(JDBC3PreparedStatement.java:52) ~[sqlite-jdbc-3.42.0.0.jar:?]
        at me.iru.data.DatabaseConnection.query(DatabaseConnection.kt:81) ~[Authy-3.5.2.jar:?]
        at me.iru.data.PlayerData.update(PlayerData.kt:89) ~[Authy-3.5.2.jar:?]
        at me.iru.data.PlayerData.create(PlayerData.kt:36) ~[Authy-3.5.2.jar:?]
        at me.iru.AuthManager.register(AuthManager.kt:19) ~[Authy-3.5.2.jar:?]
        at me.iru.commands.cRegister.onCommand(cRegister.kt:51) ~[Authy-3.5.2.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more

Also:

[22:50:01 WARN]: [Authy] Plugin Authy v3.5.2 generated an exception while executing task 1490147                                                                                                                                             |
java.lang.RuntimeException: Maximum pool size reached, no available connections!
        at me.iru.data.DatabaseConnection.getConnection(DatabaseConnection.kt:68) ~[Authy-3.5.2.jar:?]
        at me.iru.data.DatabaseConnection.query(DatabaseConnection.kt:78) ~[Authy-3.5.2.jar:?]
        at me.iru.data.PlayerData.getAll(PlayerData.kt:50) ~[Authy-3.5.2.jar:?]
        at me.iru.process.DuplicateProtection.getDuplicatesForIpOf(DuplicateProtection.kt:53) ~[Authy-3.5.2.jar:?]
        at me.iru.process.DuplicateProtection.check(DuplicateProtection.kt:25) ~[Authy-3.5.2.jar:?]
        at me.iru.events.LoginEvents.onInitialLogin$lambda-0(LoginEvents.kt:24) ~[Authy-3.5.2.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.20.1.jar:git-Paper-196]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-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) ~[?:?]

Version: 3.5.2 Minecraft version: 1.20.1 Config file:

nameValidation: true
timeout: 60
passwordValidation:
  minLength: 4
  maxLength: 32
  minUppercase: 0
  minNumbers: 0
pinValidation:
  minLength: 4
  maxLength: 10
effects:
  title: true
  particles: true
  sounds: true
  blindness: true
welcomeMessage:
  text:
  - '&7Добро пожаловать на сервер &6FireWorld&7! Желаем вам приятной игры!'
  enabled: true
requirePin: false
sendPinSetReminder: true
sessionExpiresIn: 48
onFirstJoin:
  teleport: true
  x: -483
  y: 70
  z: 969
  yaw: 0
  pitch: 0
  world: world
onJoin:
  # Concealment if set to true (also requires teleport to be true) will teleport a player to their position after authentication
  concealment: true
  teleport: true
  x: -483
  y: 70
  z: 969
  yaw: 0
  pitch: 0
  world: world
duplicateIpProtection:
  # 0 - No protection
  # 1 - Max is applied to online players
  # 2 - Max is applied to registered players
  protectionLevel: 2
  maxPerIp: 1
  notifyOnDuplicateIp: true
database:
  type: sqlite # mysql or sqlite
  credentials: # Only for mysql, ignore if using sqlite
    host: 127.0.0.1:3306
    user: root
    password: root
    database: authy
lang: ru_ru
f1refa11 commented 7 months ago

I guess this is because the plugin already uses the data.db file, and when another player is trying to execute a command it just can't because the file is busy

oplexz commented 6 months ago

Does this error occur consistently, or every now and then? Do you have any ideas on how to reproduce this problem?

This might be caused by several DB operations being performed at once (e.g. two players registering at the same time -- although, unless they did it with pinpoint accuracy, it's highly unlikely -- the DB operations take a very short span of time.)

f1refa11 commented 6 months ago

Does this error occur consistently

Yes, it occurs very often, and this is the problem why almost all the players can't login.

Do you have any ideas on how to reproduce this problem?

Unfortunately, i have no idea how to reproduce this, as it happens randomly, all I know is that is happens when there's more than 1 player in the server. So i guess you should just try authorizing from different accounts until the error occurs.