@tsteur opened this Issue on July 12th 2021 Member

when calling MultiSites.getAll

<a href='/0'>#0</a> /plugins/SitesManager/API.php(244): Piwik\Site::setSiteFromArray(-1, false)
<a href='/1'>#1</a> /core/Site.php(480): Piwik\Plugins\SitesManager\API->getSiteFromId(-1)
<a href='/2'>#2</a> /core/Site.php(520): Piwik\Site::getFor(-1, 'name')
<a href='/3'>#3</a> [internal function]: Piwik\Site::getNameFor(-1)
<a href='/4'>#4</a> /core/DataTable/Filter/ColumnCallbackReplace.php(96): call_user_func_array('\\Piwik\\Site::ge...', Array)
<a href='/5'>#5</a> /core/DataTable.php(528): Piwik\DataTable\Filter\ColumnCallbackReplace->filter(Object(Piwik\DataTable))
<a href='/6'>#6</a> /core/DataTable.php(613): Piwik\DataTable->filter('Piwik\\DataTable...', Array)
<a href='/7'>#7</a> /core/API/DataTablePostProcessor.php(303): Piwik\DataTable->applyQueuedFilters()
<a href='/8'>#8</a> /core/API/DataTablePostProcessor.php(133): Piwik\API\DataTablePostProcessor->applyQueuedFilters(Object(Piwik\DataTable))
<a href='/9'>#9</a> /core/API/ResponseBuilder.php(190): Piwik\API\DataTablePostProcessor->process(Object(Piwik\DataTable))
<a href='/10'>#10</a> /core/API/ResponseBuilder.php(104): Piwik\API\ResponseBuilder->handleDataTable(Object(Piwik\DataTable))
<a href='/11'>#11</a> /core/API/Request.php(272): Piwik\API\ResponseBuilder->getResponse(Object(Piwik\DataTable), 'MultiSites', 'getAll')
<a href='/12'>#12</a> /core/Context.php(28): Piwik\API\Request->Piwik\API\{closure}()
<a href='/13'>#13</a> /core/API/Request.php(273): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
<a href='/14'>#14</a> /core/API/Request.php(559): Piwik\API\Request->process()
<a href='/15'>#15</a> /plugins/Cloud/Dao/SystemState.php(579): Piwik\API\Request::processRequest('MultiSites.getA...', Array)

Seems there is maybe an other row and https://github.com/matomo-org/matomo/blob/4.4.0-b1/plugins/MultiSites/API.php#L275 is applied maybe to the others row. Thinking this could be a regression from recent -1 changes.

Interestingly that instance has only 38 sites though so not sure it is caused by an others row but sounds like it. Maybe indirectly a lower limit was applied or so not sure.

@sgiehl commented on July 14th 2021 Member

@tsteur do we maybe have the query string that caused the error?

@tsteur commented on July 14th 2021 Member

It was during archiving

@tsteur commented on July 14th 2021 Member
<a href='/18'>#18</a> [internal function]: Piwik\Plugins\Account2\Tasks->...(NULL)
<a href='/19'>#19</a> /core/Scheduler/Scheduler.php(266): call_user_func(Array, NULL)
<a href='/20'>#20</a> /core/Scheduler/Scheduler.php(138): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
<a href='/21'>#21</a> /plugins/CoreAdminHome/API.php(69): Piwik\Scheduler\Scheduler->run()
<a href='/22'>#22</a> /core/CronArchive.php(621): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
<a href='/23'>#23</a> /core/CronArchive.php(264): Piwik\CronArchive->runScheduledTasks()
<a href='/24'>#24</a> /core/Access.php(664): Piwik\CronArchive->Piwik\{closure}()
<a href='/25'>#25</a> /core/CronArchive.php(269): Piwik\Access::doAsSuperUser(Object(Closure))
<a href='/26'>#26</a> /plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
<a href='/27'>#27</a> /vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/28'>#28</a> /vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/29'>#29</a> /vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/30'>#30</a> [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/31'>#31</a> /core/Console.php(130): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/32'>#32</a> /core/Access.php(673): Piwik\Console->Piwik\{closure}()
<a href='/33'>#33</a> /core/Console.php(131): Piwik\Access::doAsSuperUser(Object(Closure))
<a href='/34'>#34</a> /core/Console.php(82): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/35'>#35</a> /vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/36'>#36</a> /console(32): Symfony\Component\Console\Application->run()
@sgiehl commented on July 16th 2021 Member

I tried to reproduce that, but wasn't able to. It is actually triggered in a task of Account2 plugin, which calls

        $multiSites = Request::processRequest('MultiSites.getAll', array(
            'period' => 'range',
            'date' => $from . ',' . $to,
            'showColumns' => 'nb_actions,nb_pageviews'
        ));

Haven't yet figured out why there might occur a record holding -1 as label, but it seems to be returned here: https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/MultiSites/API.php#L237

@diosmosis commented on July 18th 2021 Member

@sgiehl if you add 'filter_limit'=>-1 to Account2 do you still get the same issue?

EDIT: I'm guessing it happens if there's more than 100 sites.

@tsteur commented on July 18th 2021 Member

If it's not easily reproducible we can also modify the milestone and remove "regression" label for now and wait until it happens again (if it does).

@sgiehl commented on July 19th 2021 Member

@diosmosis I wasn't able to reproduce that locally. Even when creating more than 100 sites, the MultiSites API still returns a valid result.
The request is sent without a third parameter for Request::processRequest, so the current request object is used. Maybe it contained some specific parameter during that archiving run that caused the failure? But I'm not sure what that could be. Tried to send various api parameters locally, but everything worked as expected.

@diosmosis commented on July 19th 2021 Member

@sgiehl only other thing I can think of is filter_truncate which would add a summary row.

@sgiehl commented on July 19th 2021 Member

it seems to be filter_truncate. will check if it's easy to support that filter

This Issue was closed on July 19th 2021
Powered by GitHub Issue Mirror