Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled task "checkSiteHasTrackedVisits" fails with exception User doesn't exist #19907

Open
tsteur opened this issue Oct 25, 2022 · 4 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@tsteur
Copy link
Member

tsteur commented Oct 25, 2022

see below stack trace

ERROR [2022-10-24 02:05:15] 2060 Uncaught exception in API: Exception: User 'MyUsername' doesn't exist. in plugins/UsersManager/API.php:1303
Stack trace:
#0 plugins/UsersManager/API.php(677): Piwik\Plugins\UsersManager\API->checkUserExists('MyUsername')
#1 [internal function]: Piwik\Plugins\UsersManager\API->getUser('MyUsername')
#2 core/API/Proxy.php(244): call_user_func_array(Array, Array)
#3 core/Context.php(28): Piwik\API\Proxy->Piwik\API{closure}()
#4 core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#5 core/API/Request.php(267): Piwik\API\Proxy->call('\Piwik\Plugins\...', 'getUser', Array)
#6 core/API/Request.php(560): Piwik\API\Request->process()
#7 plugins/CoreAdminHome/Tasks.php(165): Piwik\API\Request::processRequest('UsersManager.ge...', Array)
#8 [internal function]: Piwik\Plugins\CoreAdminHome\Tasks->checkSiteHasTrackedVisits('3')
#9 core/Scheduler/Scheduler.php(309): call_user_func(Array, '3')
#10 core/Scheduler/Scheduler.php(154): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#11 plugins/CoreAdminHome/API.php(75): Piwik\Scheduler\Scheduler->run()
#12 core/CronArchive.php(653): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#13 core/CronArchive.php(279): Piwik\CronArchive->runScheduledTasks()
#14 core/Access.php(661): Piwik\CronArchive->Piwik{closure}()
#15 core/CronArchive.php(284): Piwik\Access::doAsSuperUser(Object(Closure))
#16 plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#17 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))
#18 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))
#19 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))
#20 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 core/Console.php(135): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 core/Access.php(670): Piwik\Console->Piwik{closure}()
#23 core/Console.php(136): Piwik\Access::doAsSuperUser(Object(Closure))
#24 core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 console(32): Symfony\Component\Console\Application->run()
#27 {main}
ERROR [2022-10-24 02:05:15] 2060 Scheduler: Error User 'MyUsername' doesn't exist. for task 'Piwik\Plugins\CoreAdminHome\Tasks.checkSiteHasTrackedVisits_3'

Expected:

Error is caught in https://github.com/matomo-org/matomo/blob/4.12.2/plugins/CoreAdminHome/Tasks.php#L164-L169 as we would otherwise just return anyway if email not found

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Oct 25, 2022
@bx80
Copy link
Contributor

bx80 commented Oct 26, 2022

Thanks @tsteur, so just to clarify - the checkSiteHasTrackedVisits scheduled task is trying to find the user who created the site, but if that user no longer exists, instead of throwing an exception, we should simply abort the task and return 👍

I've scheduled this for prioritization.

@bx80 bx80 added this to the For Prioritization milestone Oct 26, 2022
@tsteur
Copy link
Member Author

tsteur commented Mar 14, 2023

This happened again twice today.

@tsteur
Copy link
Member Author

tsteur commented May 30, 2023

This problem happened again.

@tsteur
Copy link
Member Author

tsteur commented Nov 22, 2023

This happened again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants