PreciousStones

PreciousStones

269k Downloads

Crash while MySQL tables are locked

zford opened this issue ยท 1 comments

commented

PStone hangs server is mysql tables are locked in read mode. This should never happen. Ideally, the pstone operation will get queued until mysql is unlocked (potentially time out, if that's possible).

Here is the stack trace of the relevant section (server event loop, and scheduler thread). In this case, the server thread is blocked on synchronized(this), because another thread that is synchronized was waiting for a mysql table unlock.

2013-08-09 04:03:15 [SEVERE] ------------------------------
2013-08-09 04:03:15 [SEVERE] Current Thread: Craft Scheduler Thread - 2
2013-08-09 04:03:15 [SEVERE] PID: 54 | Suspended: false | Native: true | State: RUNNABLE
2013-08-09 04:03:15 [SEVERE] Thread is waiting on monitor(s):
2013-08-09 04:03:15 [SEVERE] Locked on:com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
2013-08-09 04:03:15 [SEVERE] Locked on:com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
2013-08-09 04:03:15 [SEVERE] Locked on:com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1662)
2013-08-09 04:03:15 [SEVERE] Locked on:com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1748)
2013-08-09 04:03:15 [SEVERE] Locked on:net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager.updatePlayer(StorageManager.java:1326)
2013-08-09 04:03:15 [SEVERE] Stack:
2013-08-09 04:03:15 [SEVERE] java.net.SocketInputStream.socketRead0(Native Method)
2013-08-09 04:03:15 [SEVERE] java.net.SocketInputStream.read(SocketInputStream.java:150)
2013-08-09 04:03:15 [SEVERE] java.net.SocketInputStream.read(SocketInputStream.java:121)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2526)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2968)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3516)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1662)
2013-08-09 04:03:15 [SEVERE] com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1748)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.storage.MySQLCore.insert(MySQLCore.java:142)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager.updatePlayer(StorageManager.java:1326)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager.processPlayers(StorageManager.java:2496)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager.processQueue(StorageManager.java:2394)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager$3.run(StorageManager.java:2335)
2013-08-09 04:03:15 [SEVERE] org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftTask.run(CraftTask.java:58)
2013-08-09 04:03:15 [SEVERE] org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
2013-08-09 04:03:15 [SEVERE] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
2013-08-09 04:03:15 [SEVERE] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
2013-08-09 04:03:15 [SEVERE] java.lang.Thread.run(Thread.java:722)
2013-08-09 04:03:15 [SEVERE] ------------------------------
2013-08-09 04:03:15 [SEVERE] Current Thread: Server thread
2013-08-09 04:03:15 [SEVERE] PID: 11 | Suspended: false | Native: false | State: BLOCKED
2013-08-09 04:03:15 [SEVERE] Stack:
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.StorageManager.retrieveBlockGrief(StorageManager.java:1427)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.GriefUndoManager.undoGrief(GriefUndoManager.java:189)
2013-08-09 04:03:15 [SEVERE] net.sacredlabyrinth.Phaed.PreciousStones.managers.GriefUndoManager$1.run(GriefUndoManager.java:311)
2013-08-09 04:03:15 [SEVERE] org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftTask.run(CraftTask.java:58)
2013-08-09 04:03:15 [SEVERE] org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345)
2013-08-09 04:03:15 [SEVERE] net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:518)
2013-08-09 04:03:15 [SEVERE] net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:239)
2013-08-09 04:03:15 [SEVERE] net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:481)
2013-08-09 04:03:15 [SEVERE] net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:413)
2013-08-09 04:03:15 [SEVERE] net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
2013-08-09 04:03:15 [SEVERE] ------------------------------

I have "fixed" the issue on my side so the table won't lock again, but this still deserves being noticed, if nothing else to get that particular function out of the main server loop.

commented

This was using PreciousStones 9.6.0-SNAPSHOT (9.6.0 download link on dev.bukkit.org)