MySQL query error [1615]: Prepared statement needs to be re-prepared (Recurring)

invictus

Active member
I got this error in my server log twice after upgrading from 1.5 to XF2. I cleared them and kept working, everything seems to be fine on the forum.

Now I am seeing the same error again. Not sure how to read it or what it means.

Server error log
Code:
XF\Db\Exception: MySQL query error [1615]: Prepared statement needs to be re-prepared src/XF/Db/AbstractStatement.php:183
Generated by: Unknown account Oct 18, 2017 at 12:30 AM

Stack trace
Code:
#0 src/XF/Db/Mysqli/Statement.php(66): XF\Db\AbstractStatement->getException('MySQL query err...', 1615)
#1 src/XF/Db/AbstractAdapter.php(67): XF\Db\Mysqli\Statement->execute()
#2 src/XF/Mvc/Entity/Finder.php(1105): XF\Db\AbstractAdapter->query('\r\n\t\t\tSELECT `xf...')
#3 src/XF/Pub/Controller/Forum.php(983): XF\Mvc\Entity\Finder->fetchOne()
#4 src/XF/Pub/Controller/Forum.php(190): XF\Pub\Controller\Forum->assertViewableForum('7', Array)
#5 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Forum->actionForum(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'Forum', 'html', Object(XF\Mvc\ParameterBag), 'forums', Object(XF\Pub\Controller\Forum), Object(XF\Mvc\Reply\Reroute))
#7 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(1831): XF\Mvc\Dispatcher->run()
#9 src/XF.php(328): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}

Request state
Code:
array(4) {
  ["url"] => string(40) "/forum/forums/general-board.7/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Generally this is a server side issue rather than a code issue.

It was a larger problem in some older MySQL versions but I when it is seen now changing table_definition_cache is the solution. This can be changed in my.cnf or by your host.
 
Still getting these with table_definition_cache=1200, do I need to increase the value again or could this be another issue?

Server error log

Code:
XF\Db\Exception: MySQL query error [1615]: Prepared statement needs to be re-prepared src/XF/Db/AbstractStatement.php:183
Generated by: Unknown account Oct 18, 2017 at 4:30 PM

Stack trace
Code:
#0 src/XF/Db/Mysqli/Statement.php(66): XF\Db\AbstractStatement->getException('MySQL query err...', 1615)
#1 src/XF/Db/AbstractAdapter.php(67): XF\Db\Mysqli\Statement->execute()
#2 src/XF/Mvc/Entity/Finder.php(1138): XF\Db\AbstractAdapter->query('\r\n\t\t\tSELECT `xf...')
#3 src/XF/Pub/Controller/Thread.php(36): XF\Mvc\Entity\Finder->fetch()
#4 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Thread->actionIndex(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'Index', 'html', Object(XF\Mvc\ParameterBag), 'forums', Object(DBTech\PreviewLastPost\XF\Pub\Controller\Thread), NULL)
#6 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(1831): XF\Mvc\Dispatcher->run()
#8 src/XF.php(328): XF\App->run()
#9 index.php(13): XF::runApp('XF\\Pub\\App')
#10 {main}

Request state
Code:
array(4) {
  ["url"] => string(52) "/forum/threads/enhancing-old-35mm-slide-scans.60742/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
It could be another issue. Unfortunately there's an on-going debacle where people who have experienced this issue feel that it is a bug and they report it as such but it has been claimed it isn't a bug. It was definitely more prevalent in older versions IIRC, though clearly people are still experiencing it. Worth a read:

https://bugs.mysql.com/bug.php?id=42041

There might be some other solutions mentioned in there.

Ultimately if possible it might be something to raise with your hosting provider.
 
So essentially, if you're seeing 5-10 of these a day in the admin logs you can just clear the log? I haven't been able to figure out what to do about these errors in the logs. Liquidweb doesn't know what to do except suggest I ask the script developer, and based on what I've read here it's not a Xenforo problem. And LW usually always helps troubleshoot things that are well beyond the scope of their support.
 
I just got this error after upgrading XF2 to the latest release 2.1.7 yesterday:

XF\Db\Exception: MySQL query error [1615]: Prepared statement needs to be re-prepared
src/XF/Db/AbstractStatement.php:228
Generated by: xxxxxxxxx Jan 11, 2020 at 8:30 PM
 
Back
Top Bottom