XF 1.3 Prepared statement needs to be re-prepared


Well-known member
Hi all,
My board has been running well for the past couple of years then today I get hit with these errors. I have looked at https://xenforo.com/community/threads/error-in-error-log.19033/
Which seems to be pointing at InnoDB not being active, but I have my own server with Linode and I can confirm it's up and running.

When starting a new thread I got this:
Mysqli statement execute error : Prepared statement needs to be re-prepared
[*]Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
[*]Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
[*]Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 825
[*]Zend_Db_Adapter_Abstract->fetchOne() in XenForo/Session.php at line 719
[*]XenForo_Session->getSessionFromSource() in XenForo/Session.php at line 429
[*]XenForo_Session->_setup() in XenForo/Session.php at line 413
[*]XenForo_Session->start() in XenForo/Session.php at line 318
[*]XenForo_Session::getPublicSession() in XenForo/Session.php at line 257
[*]XenForo_Session::startPublicSession() in XenForo/Controller.php at line 291
[*]XenForo_Controller->_setupSession() in XenForo/Controller.php at line 304
[*]XenForo_Controller->preDispatch() in XenForo/FrontController.php at line 346
[*]XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
[*]XenForo_FrontController->run() in /srv/www/pixelatedphotographer.com/public_html/forums/index.php at line 13
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Prepared statement needs to be re-prepared - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Unknown Account, 5 minutes ago
Stack Trace

#0 /srv/www/pixelatedphotographer.com/public_html/forums/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /srv/www/pixelatedphotographer.com/public_html/forums/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /srv/www/pixelatedphotographer.com/public_html/forums/library/Zend/Db/Adapter/Abstract.php(825): Zend_Db_Adapter_Abstract->query('\n\t\t\t\tSELECT ses...', Array)
#3 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Session.php(719): Zend_Db_Adapter_Abstract->fetchOne('\n\t\t\t\tSELECT ses...', Array)
#4 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Session.php(429): XenForo_Session->getSessionFromSource('7494d9c9e471ea6...')
#5 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Session.php(413): XenForo_Session->_setup('7494d9c9e471ea6...', '\x99\xA2\xB0\xB2')
#6 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Session.php(318): XenForo_Session->start()
#7 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Session.php(257): XenForo_Session::getPublicSession(Object(Zend_Controller_Request_Http))
#8 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Controller.php(291): XenForo_Session::startPublicSession(Object(Zend_Controller_Request_Http))
#9 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/Controller.php(304): XenForo_Controller->_setupSession('AddThread')
#10 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/FrontController.php(346): XenForo_Controller->preDispatch('AddThread', 'XenForo_Control...')
#11 /srv/www/pixelatedphotographer.com/public_html/forums/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /srv/www/pixelatedphotographer.com/public_html/forums/index.php(13): XenForo_FrontController->run()
#13 {main}

Request State

array(3) {
  ["url"] => string(90) "http://www.pixelatedphotographer.com/forums/index.php?forums/website-updates.11/add-thread"
  ["_GET"] => array(1) {
    ["forums/website-updates_11/add-thread"] => string(0) ""
  ["_POST"] => array(13) {
    ["title"] => string(24) "Plugins disabled on site"
    ["message_html"] => string(841) "<p>Hi all, <br></p><p>As a few people have mentioned there have been issues with the website of late - not loading pages and database errors has been a problem in some cases.</p><p><br></p><p>To investigate the error I'm pulling all the plugins on the site off so that I can look for bugs. <b>These include the chat boxes</b> and a few things dotted around the website. <b><br></b></p><p><b>Tapatalk and forumrunner will also be offline during this period.</b></p><p><br></p><p>I think that I want to test everything without plugins until the weekend, so please be patient while we resolve the error. I'd prefer a little inconvenience than watching our database explode.</p><p><br></p><p><b>If there are any database engineers on the site please PM me - I could do with help on this one!</b></p><p><br></p><p>Cheers, <br>Chris</p><p><br></p>"
    ["_xfRelativeResolver"] => string(93) "http://www.pixelatedphotographer.com/forums/index.php?forums/website-updates.11/create-thread"
    ["attachment_hash"] => string(32) "e64f2a465ecd446265b90a79373298ff"
    ["watch_thread_state"] => string(1) "1"
    ["discussion_open"] => string(1) "1"
    ["_set"] => array(2) {
      ["discussion_open"] => string(1) "1"
      ["sticky"] => string(1) "1"
    ["sticky"] => string(1) "1"
    ["poll"] => array(2) {
      ["question"] => string(0) ""
      ["responses"] => array(2) {
        [0] => string(0) ""
        [1] => string(0) ""
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(57) "/forums/index.php?forums/website-updates.11/create-thread"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
Looking at the database via phpmyadmin I found the following:
Slow_queries    2,559    The number of queries that have taken more than long_query_time seconds.


Innodb_buffer_pool_reads    3,023 k    The number of logical reads that InnoDB could not satisfy from buffer pool and had to do a single-page read.

I know this is probably a database error or maybe MYSQL settings, but any ideas would be really helpful.

It looks like the tables are pretty damaged and I hope they are repairable.

Any ideas?



Well-known member
Have you tried restarting MySQL?
Cheers Brogan. Yeah it was the first thing that I did. I have also just restarted the Linode as well just to make sure.
Right now it's stable but I saw the same thing happen this morning before it went nuts.

I also noticed a high use of i/o on the server too - and this also looked like it was coming my mysql. so something there.

cheers @Mike just got the message as I was writing. I'll have a look at table_definition_cache and let's see how it goes!