XF 2.0 Bad Server Error. Forum inaccessible.

deslocotoco

Well-known member
My hosting company is telling me that my Forum is "locking" the database.

I cannot enter anymore on my Forum, the error is this: "An unexpected database error occurred. Please try again later."

And they send me this log:

41 politz localhost forum 26 Prepar -- XFDB=noForceAllWrite INSERT INTO xf_session (session_id, session_data, expiry_date) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE session_data = VALUES(session_data), expiry_date = VALUES(expiry_date)
40 politz localhost forum 28 Prepar -- XFDB=fromWrite SELECT session_data FROM xf_session WHERE session_id = ? AND expiry_date >= ?
33 politz localhost forum 36 Prepar -- XFDB=noForceAllWrite INSERT INTO xf_session (session_id, session_data, expiry_date) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE session_data = VALUES(session_data), expiry_date = VALUES(expiry_date)
34 politz localhost forum 50 Prepar -- XFDB=noForceAllWrite INSERT INTO xf_session (session_id, session_data, expiry_date) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE session_data = VALUES(session_data), expiry_date = VALUES(expiry_date)
38 politz localhost forum 52 Prepar -- XFDB=noForceAllWrite INSERT INTO xf_session (session_id, session_data, expiry_date) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE session_data = VALUES(session_data), expiry_date = VALUES(expiry_date)
39 politz localhost forum 52 Prepar -- XFDB=fromWrite SELECT session_data FROM xf_session WHERE session_id = ? AND expiry_date >= ?
36 politz localhost forum 53 Prepar -- XFDB=fromWrite SELECT session_data FROM xf_session WHERE session_id = ? AND expiry_date >= ?
37 politz localhost forum 53 Prepar -- XFDB=fromWrite SELECT session_data FROM xf_session WHERE session_id = ? AND expiry_date >= ?
35 politz localhost forum 54 Prepar -- XFDB=fromWrite SELECT session_data FROM xf_session WHERE session_id = ? AND expiry_date >

I don't know what to do.
 
You can try running this query:
Code:
REPAIR TABLE xf_session;

If that doesn't resolve it, there are other options, though I'd be a little concerned as to what happened to the server to trigger this as this would indicate some issue (such as it crashing, MySQL being killed, running out of space, etc).
 
Thanks.

I tried to run this query but i cant even access phpmyadmin. Is really out of the air.

My host company tell me that the problem is "the forum causing a problems on the server". But i never saw this happening ever.

Some error logs on my Admin Panel:

MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

Um momento atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

Um momento atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

1 minuto atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction

2 minutos atrás src/XF/Db/AbstractStatement.php:212


MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction
 
If you can't run that query, then your host should be able to. The table has been corrupted and it certainly seems like that's causing problems.

Otherwise, your host really should be able to debug and figure out why this suddenly may be a problem. In a normally functioning server, the queries they showed are trivial to execute. The fact that they aren't executing properly could indicate server load issues (or it could be related to the corruption your last error indicated).
 
I did manage to "close" the Forum in the Admin Panel and i did manage to run this query: REPAIR TABLE xf_session and was successful.

But the problems are still happening and i really don't know what to do.

I can't post anything. My DB only have 1.8GB.

When i try to post i get this error:

XF\Db\Exception: MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction src/XF/Db/AbstractStatement.php:212

Generated by: POLITZ 3/12/18 at 16:26

Stack trace

INSERT INTO xf_post (`thread_id`, message_state, user_id, username, message, embed_metadata, post_date, post_id, ip_id, attach_count, likes, like_users, warning_id, warning_message, last_edit_date, last_edit_user_id, edit_count, position) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1205, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1205, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(79): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(160): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1403): XF\Db\AbstractAdapter->insert('xf_post', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1135): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/Thread/Replier.php(167): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\Thread\Replier->_save()
#8 src/XF/Pub/Controller/Thread.php(440): XF\Service\Thread\Replier->save()
#9 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', 'json', Object(XF\Mvc\ParameterBag), 'forums', Object(XF\Pub\Controller\Thread), NULL)
#11 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#13 src/XF.php(329): XF\App->run()
#14 index.php(13): XF::runApp('XF\\Pub\\App')
#15 {main}

Request state

array(4) {
["url"] => string(79) "/index.php?threads/o-foro-nao-ta-aguentando-a-migracao-em-massa.20972/add-reply"
["referrer"] => string(97) "https://forum.politz.com.br/index.php?threads/o-foro-nao-ta-aguentando-a-migracao-em-massa.20972/"
["_GET"] => array(1) {
["threads/o-foro-nao-ta-aguentando-a-migracao-em-massa_20972/add-reply"] => string(0) ""
}
["_POST"] => array(9) {
["message_html"] => string(16) "<p>Testando.</p>"
["attachment_hash"] => string(32) "8eededde6f1de5c59c6109998be66497"
["attachment_hash_combined"] => string(87) "{"type":"post","context":{"thread_id":20972},"hash":"8eededde6f1de5c59c6109998be66497"}"
["last_date"] => string(10) "1543861055"
["last_known_date"] => string(10) "1543861055"
["_xfToken"] => string(8) "****"
["_xfRequestUri"] => string(70) "/index.php?threads/o-foro-nao-ta-aguentando-a-migracao-em-massa.20972/"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
 
This is really a situation where your host/server admin would need to investigate, as it generally sounds like the server is heavily loaded right now or MySQL is having fairly internal problems. They would need to take steps to identify the root cause and resolve that, as it is very possible that any issues you're still having are simply knock on effects.
 
I'm thinking about changing my host because they really showing that they don't want to help me solve the problem.

They ask me to do a repair on the DB, but i can't even access phpmyadmin. When i can access for some minutes, any query that i run keeps on "loading..." and return a error, like this:

Error on process request
Error code: 524
Error Text: No reason Phrase (rejected)
Seems like the server lost the connection. Please verify the connectivity of your network and the server state.

Do you guys can recommend any hosting company, specially for a Forum?
 
Our site just experienced the same issue with XF_SESSION marked as crashed. I found a solution not mentioned on this forum which is to TRUNCATE TABLE XF_SESSION rather than REPAIR it. Truncating it got us back on the air instantly.

I saw on our old VB site that we would frequently get swarmed by hundreds, maybe thousands of bots trying to do who knows what. All I could see is that our active user count would jump from 50 to over 1,000, and then that would trigger DB max connection rejections until the swarm moved on. Could a sudden, very high level of guest users overwhelm the session manager and bust the XF_SESSION table?
 
I found a solution not mentioned on this forum

:unsure:

Try to repair the xf_session_admin table, otherwise truncating it should work.

Repair or truncate the xf_session table, using phpMyAdmin.

Repair or truncate the xf_session table.

If it keeps happening, contact your host and ask them to investigate the server as it indicates instability or unexpected restarts, etc.

Repair or truncate the session table using phpMyAdmin.
 
I'll keep an eye on it. The initiating error logged was:

Incorrect key file for table 'xxxxxx/xf_session.MYI'; try to repair it

Since this site is running on a shared server managed by a hosting company I don't have a whole lot of visibility into what is actually going on with it. If this happens again I'll contact them. This is a 1st for us in 18 years running other non-XF forums on this company's servers.
 
Top Bottom