Not a bug Data too long for column 'stats_type'

abdfahim

Well-known member
Affected version
2.0.1
Got this error today in the server error log, not sure if this is from XF or any addon (I use 2 addons only).

XF\Db\Exception: MySQL query error [1406]: Data too long for column 'stats_type' at row 1 src/XF/Db/AbstractStatement.php:212
Generated by: Unknown account Jan 4, 2018 at 11:30 AM

Stack trace
INSERT INTO `xf_stats_daily` (`stats_date`, `stats_type`, `counter`) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE counter = 2
------------

#0 src/XF/Db/Mysqli/Statement.php(174): XF\Db\AbstractStatement->getException('MySQL query err...', 1406, '22001')
#1 src/XF/Db/Mysqli/Statement.php(69): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1406, '22001')
#2 src/XF/Db/AbstractAdapter.php(74): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array)
#4 src/XF/Repository/Stats.php(72): XF\Db\AbstractAdapter->insert('xf_stats_daily', Array, false, 'counter = 2')
#5 src/XF/Cron/Counters.php(30): XF\Repository\Stats->build(1514937600, 1515024000)
#6 [internal function]: XF\Cron\Counters::recordDailyStats(Object(XF\Entity\CronEntry))
#7 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#8 src/XF/Job/Manager.php(241): XF\Job\Cron->run(7.9999988079071)
#9 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999988079071)
#10 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999988079071)
#11 job.php(15): XF\Job\Manager->runQueue(false, 8)
#12 {main}


Request state
array(4) {
["url"] => string(8) "/job.php"
["referrer"] => string(135) "https://www.example.com/threads/thread-title.42693/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
When we had this reported before, it could really only be down to an add-on, so that would be what I'd check. What add-ons do you have installed?
 
I use Chat 2 (Siropu) and Content Rating (Xon).

I also have a simple addon coded by myself, but that only reads from the database, doesn't add/update any table/column.
 
This is a bug in Content Rating. It is because the state_type column is 25 characters (which is generally content type + action), while most content_type like columns are 25 characters. Will work on reducing the size.

It would be nice if XF gave better feedback on the content type handle & stat_type which was badly sized
 
Hmm, interesting. A question. Is there any way to understand whether the core or an addon is causing the issue just looking at the stack trace?
 
Hmm, interesting. A question. Is there any way to understand whether the core or an addon is causing the issue just looking at the stack trace?
Nope, it requires an backwards compatible change in XF2 to provide some sane logging.
 
Top Bottom