Civcraft / JukeAlert

Do not open issues here; open them on the maintained fork @ DevotedMC
https://github.com/DevotedMC/JukeAlert
BSD 3-Clause "New" or "Revised" License
5 stars 15 forks source link

JA losing db connection seeming randomly #66

Closed Maxopoly closed 8 years ago

Maxopoly commented 8 years ago

Sometimes JA will just lose db connection and every single db hit will then throw an exception. Happening multiple times daily in CivTemp for the last few days. Manual restart is required every time this breaks.

ProgrammerDan commented 8 years ago

Can you check /etc/mysql/my.cnf and see what the connection limit is?

I have a sneaking suspicion that we're running out of available connections, so reconnects are failing.

Maxopoly commented 8 years ago

max_connections = 100 │···························································· connect_timeout = 5 │···························································· wait_timeout = 600 │···························································· max_allowed_packet = 16M │···························································· thread_cache_size = 128 │···························································· sort_buffer_size = 4M │···························································· bulk_insert_buffer_size = 16M │···························································· tmp_table_size = 32M │···························································· max_heap_table_size = 32M

ProgrammerDan commented 8 years ago

What does show status wherevariable_name= 'Threads_connected'; show when run?

Maxopoly commented 8 years ago

85 after just restarting

ProgrammerDan commented 8 years ago

Culprit: very likely found. Hmm.

If you've got sudo (I think you do) bump the max_connections to 300. sudo service mysql restart to hup it, although it will cause everything to be very angry with you as it'll hard term any active connections. This will probably not be needed on the non-global DB server.

ProgrammerDan commented 8 years ago

Alternatively just stop the cluster, restart the DB service, the start the cluster of course...

Maxopoly commented 8 years ago

I think I have sudo, but I never got a password, so I guess it'll have to wait. But at least we got it solved.

ProgrammerDan commented 8 years ago

Yeah. I'm about 90% sure this is root cause.

ProgrammerDan commented 8 years ago

I have sudo

Check by issuing sudo su. Enter your own account's password. If your account doesn't have a password, you can add a strong one via passwd unless that's been disabled. Definitely use as strong a password as you can tolerate :).

Maxopoly commented 8 years ago

I can't even get into my user though, as I automatically get logged into civcraft-admins every time and would need my password to switch.

ProgrammerDan commented 8 years ago

OH, Gotcha. When you exit out of civcraft-admins you don't wind up as your user?

Maxopoly commented 8 years ago

Ah yeah, I can do that but it requests my sudo password when doing sudo su and the current unix password when doing passwd.

ProgrammerDan commented 8 years ago

Waiting it is, then :D

Maxopoly commented 8 years ago

No longer happening after https://github.com/Civcraft/JukeAlert/commit/a71921c3fb5bcae299c11ba114fb80b7940a496b