SQL Connection suddenly lost

Discussion in 'Bukkit Help' started by silthus, Jan 11, 2013.

Thread Status:
Not open for further replies.
  1. Hi,

    I have a very strange problem since a rather long time now and already tried everything I could think of but it still keeps coming up and up again.

    After rather long time frame some plugins suddenly loose their SQL Connection and start crashing one by one after each other. The thing is that they dont loose the SQL Connection all at the same time but over a long period like 2-10 hours and some never loose the connection.

    In the console I get this error:

    Code:
    2012-12-25 11:11:26 [INFO] [mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds...
    2012-12-25 11:11:26 [INFO] caro336[/84.136.30.118:50486] logged in with entity id 21861237 at ([world] 77.5, 97.0, 256.5)
    2012-12-25 11:11:26 [SEVERE] [RaidCraft] DelegatingConstructorAccessorImpl.java[45] Communications link failure
     
    The last packet successfully received from the server was 32,589,231 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
    2012-12-25 11:11:26 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
     
    The last packet successfully received from the server was 32,589,231 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    2012-12-25 11:11:26 [SEVERE]    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3082)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2968)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3516)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2273)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.raidcraft.database.RCDatabase.executeQuery(RCDatabase.java:357)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.raidcraft.database.RCDatabase.executeQuery(RCDatabase.java:269)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.tables.Players.getPlayer(Players.java:98)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.tables.Players.exists(Players.java:58)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.data.PlayerConfig.exists(PlayerConfig.java:25)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.RCPlayer.load(RCPlayer.java:171)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.RCPlayer.<init>(RCPlayer.java:156)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.PlayerManager.getPlayer(PlayerManager.java:78)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.listeners.RCPlayerListener.onPlayerJoin(RCPlayerListener.java:34)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    2012-12-25 11:11:26 [SEVERE]    at java.lang.reflect.Method.invoke(Method.java:601)
    2012-12-25 11:11:26 [SEVERE]    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
    2012-12-25 11:11:26 [SEVERE]    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    2012-12-25 11:11:26 [SEVERE]    at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:35)
    2012-12-25 11:11:26 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
    2012-12-25 11:11:26 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.PlayerList.c(PlayerList.java:156)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.PlayerList.a(PlayerList.java:95)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.PendingConnection.d(PendingConnection.java:130)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.PendingConnection.c(PendingConnection.java:45)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.DedicatedServerConnectionThread.a(DedicatedServerConnectionThread.java:44)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:29)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:598)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:224)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:494)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:427)
    2012-12-25 11:11:26 [SEVERE]    at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
    2012-12-25 11:11:26 [SEVERE] Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2529)
    2012-12-25 11:11:26 [SEVERE]    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979)
    2012-12-25 11:11:26 [SEVERE]    ... 36 more
    2012-12-25 11:11:26 [SEVERE] [RaidCraft] Players.java[98] null
    2012-12-25 11:11:26 [SEVERE] com.silthus.raidcraft.database.exceptions.MissingDataException
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.raidcraft.database.RCDatabase.executeQuery(RCDatabase.java:361)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.raidcraft.database.RCDatabase.executeQuery(RCDatabase.java:269)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.tables.Players.getPlayer(Players.java:98)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.tables.Players.exists(Players.java:58)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.database.data.PlayerConfig.exists(PlayerConfig.java:25)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.RCPlayer.load(RCPlayer.java:171)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.RCPlayer.<init>(RCPlayer.java:156)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.PlayerManager.getPlayer(PlayerManager.java:78)
    2012-12-25 11:11:26 [SEVERE]    at com.silthus.rcskills.listeners.RCPlayerListener.onPlayerJoin(RCPlayerListener.java:34)
    2012-12-25 11:11:26 [SEVERE]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    I already tried the following but without success:
    • Increase the allowed connections in the my.cnf to 4096
    • Add the autoReconnect=true parameter to the driver
    • Made sure every plugin uses its own connection (some of my plugins had the same connection so I splitted them, that decreased the amount of plugins crashing at once)
    MySQL Version and Kernel:
    Code:
    [SIZE=13px][FONT=sans-serif][COLOR=#000000]Server version: 5.1.66-0+squeeze1[/COLOR][/FONT][/SIZE]
    [SIZE=13px][FONT=sans-serif][COLOR=#000000]MySQL client version: 5.1.63[/COLOR][/FONT][/SIZE]
    root@srvmc-main:~# uname -a
    Linux srvmc-main 2.6.32-16-pve #1 SMP Fri Nov 9 11:42:51 CET 2012 x86_64 GNU/Linux
    The SQL Server is bound to its local DMZ IP: 192.168.51.104 and not to localhost (for phpmyadmin access from the webserver).
    Has anyone any more ideas what I can try to fix this problem?
    Thanks in advance!
     
  2. Would be great if anyone could help
     
  3. Offline

    AyshineMatt

    Let me get this straight. You're using the term "SQL", and I'm assuming "SQL Lite"? Am I correct?
     
  4. No I am using MySQL for all of the connections.
     
  5. Offline

    AyshineMatt

    I can only be thinking of 2 possible solutions.

    1. Is your MySQL database opened? Like literally, is the window opened?)
    2. Is the port opened? The default port is 3306.

    Because I'm reading the errors you pasted from the console, and with it saying "Connection to MySQL was lost!", I could only think of connection troubleshooting issues.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  6. Offline

    uroskn

    MySQL is closing open connections after some time of inactivity. Put this in my.cnf and restart MySQL to disable this:

    Code:
    wait_timeout=604800
    interactive_timeout=604800
    This will set timeout to one week. :)
     
  7. Thanks for the helpful reply. I will try that and do some connection pooling in my Helper class.
     
Thread Status:
Not open for further replies.

Share This Page