SimpleClans

SimpleClans

467k Downloads

Error at SQL INSERT Query - Maybe I have a solution for you.

Rocologo opened this issue ยท 7 comments

commented

I got this error in my server console today.

[17:53:33] [Server thread/INFO]: Guest: MineSurvivor, PedoBearTheWolf
[17:53:40] [Server thread/ERROR]: Error at SQL INSERT Query: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 88,069,893 milliseconds ago. The last packet sent successfully to the server was 88,069,948 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
[17:53:40] [Server thread/ERROR]: Query: INSERT INTO sc_kills ( attacker_uuid, attacker, attacker_tag, victim_uuid, victim, victim_tag, kill_type) VALUES ( 'effe7567-54d9-4108-a461-a77448235a3d','PedoBearTheWolf','','23082a3b-f469-4dae-87de-86dc6d048b4d','MineSurvivor','','c');

I am a plugin developer myself and I have seen this problem before in my own plugin (MobHunting). The problem can happen if you open more connections that you close and after a while - hours, days, weeks this error happens. I solved my problem by adding "debug information" to the console output every time i opened or closed a connection. This way I realized that I opened more that I closed. I hope this information will help you find your bug.

commented

How can we do that? ._.

commented

Is this still an issue?

commented

And then I checked todays log and found a similar error:

[11:56:29] [Craft Scheduler Thread - 661/ERROR]: Error at SQL UPDATE Query: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 42,250,186 milliseconds ago. The last packet sent successfully to the server was 42,250,186 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
[11:56:29] [Craft Scheduler Thread - 661/ERROR]: Query: UPDATE sc_players SET name = 'Solidacid' WHERE uuid = 'b9a1ae0b-33a8-4587-962e-80d3b116c995';

commented

Thanks.
Apparently the plugin only closes the connection to the db once (onDisable).

@marcelo-mason I think that a task timer (maybe with a 6 hours period) closing and reopening the connection would solve this. Sounds good?

commented

On my own plugin i ended up opening & closing each time i wanted to, write,read,update and i have no performance issues, but I have a queue system as well.

commented

I dont Think so, i have not Seen this for a long time.

I had completely forgotten The ticket, i Think i Will close it now.

commented

Lets set autoreconnect=true, that should do it.