Administration->Database Usage->Reports throws error "The unserialization has failed!"

System Summary
804 users
240 segments
70 goals
7 tracking failures
829 websites
52 activated plugins
3 containers (in tag manager)
Matomo version: 3.14.1
MySQL version: 5.7.22-log
PHP version: 7.3.17

  1. We are migrating from an AWS Windows server/environment to an AWS Linux server/environment.

  2. The Matomo, MySQL, and PHP versions are the same for both source/target environments.

  3. We copied/restored the source database to the target database, and all users, segments, goals, tracking failures, websites, plugins, and container counts match.

  4. While simply doing a source/target side-by-side webapp screen comparison, in/on the Administration->Diagnostic->Database Usage page, in the Reports section, we see this error: “The unserialization has failed!”

  5. The following related error is in the php/log file:

WARNING DBStats[2021-05-27 16:39:28 UTC] [0a2c9] /data_disk01/matomo/core/Common.php(297): Notice - unserialize(): Error at offset 32763 of 32768 bytes - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),#1/core/Common.php(297),#2/core/DataTable.php(1402),#3/core/DataTable.php(1427),#4/core/DataTable.php(1880),#5/plugins/DBStats/MySQLMetadataProvider.php(211),#6/plugins/DBStats/MySQLMetadataProvider.php(170),#7/plugins/DBStats/API.php(203),[internal function]: Piwik\Plugins\DBStats\API->getIndividualReportsSummary(),#9/core/API/Proxy.php(237)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] Failed to get data from API: /data_disk01/matomo/core/DataTable.php(1408): The unserialization has failed!
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] The unserialization has failed!
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #0 /data_disk01/matomo/core/DataTable.php(1427): Piwik\DataTable->unserializeRows(‘a:291:{i:0;a:3:…’)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #1 /data_disk01/matomo/core/DataTable.php(1880): Piwik\DataTable->addRowsFromSerializedArray(‘a:291:{i:0;a:3:…’)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #2 /data_disk01/matomo/plugins/DBStats/MySQLMetadataProvider.php(211): Piwik\DataTable::fromSerializedArray(‘a:291:{i:0;a:3:…’)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #3 /data_disk01/matomo/plugins/DBStats/MySQLMetadataProvider.php(170): Piwik\Plugins\DBStats\MySQLMetadataProvider->getRowCountsByArchiveName(Array, ‘getEstimatedBlo…’, false, Array, Array)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #4 /data_disk01/matomo/plugins/DBStats/API.php(203): Piwik\Plugins\DBStats\MySQLMetadataProvider->getRowCountsAndSizeByBlobName(false)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #5 [internal function]: Piwik\Plugins\DBStats\API->getIndividualReportsSummary(false)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #6 /data_disk01/matomo/core/API/Proxy.php(237): call_user_func_array(Array, Array)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #7 /data_disk01/matomo/core/Context.php(28): Piwik\API\Proxy->Piwik\API{closure}()
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #8 /data_disk01/matomo/core/API/Proxy.php(328): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #9 /data_disk01/matomo/core/Plugin/Visualization.php(343): Piwik\API\Proxy->call(’\Piwik\Plugins\…’, ‘getIndividualRe…’, Array)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #10 /data_disk01/matomo/core/Plugin/Visualization.php(187): Piwik\Plugin\Visualization->loadDataTableFromAPI()
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #11 /data_disk01/matomo/core/Plugin/Report.php(320): Piwik\Plugin\Visualization->render()
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #12 /data_disk01/matomo/plugins/CoreHome/Controller.php(58): Piwik\Plugin\Report->render()
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #13 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\DBStats\Reports\GetIndividualReportsSummary))
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #14 /data_disk01/matomo/core/FrontController.php(590): call_user_func_array(Array, Array)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #15 /data_disk01/matomo/core/FrontController.php(165): Piwik\FrontController->doDispatch(‘DBStats’, ‘getIndividualRe…’, Array)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #16 /data_disk01/matomo/core/dispatch.php(34): Piwik\FrontController->dispatch()
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #17 /data_disk01/matomo/index.php(27): require_once(’/data_disk01/ma…’)
ERROR CoreHome[2021-05-27 16:39:28 UTC] [0a2c9] #18 {main}

Why?

In many cases, the general (and unhelpfully cryptic) error
"The unserialization has failed!”
goes away when we allow PHP to use more memory. The solution is to increase the memory allocated to PHP.

Update your php.ini file to increase your memory limit in the file
/etc/php/cli/php.ini
and/or at
/etc/php/apache/php.ini

To give Matomo enough memory to process your web analytics reports, increase the memory limit to 4G

memory_limit = 4G

You can learn more in: https://matomo.org/docs/setup-auto-archiving/#increase-php-memory-limit

1 Like