futureweb
(Andreas Schnederle-Wagner)
April 1, 2020, 10:13am
1
Hey there,
updated to 3.13.4 Version and got this Error Mail tonight … ?
Cron apache@stats /usr/bin/php /var/www/piwik/console database:optimize-archive-tables > /var/log/piwik.cron.log
ERROR [2020-04-01 04:15:01] 13420 Uncaught exception: /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Input/Input.php(77): Not enough arguments.
Not enough arguments.
#0 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Symfony\Component\Console\Input\Input->validate()
#1 /var/www/piwik/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))
#2 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreAdminHome\Commands\OptimizeArchiveTables), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/piwik/core/Console.php(140): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/piwik/core/Access.php(644): Piwik\Console->Piwik{closure}()
#6 /var/www/piwik/core/Console.php(141): Piwik\Access::doAsSuperUser(Object(Closure))
#7 /var/www/piwik/core/Console.php(93): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/piwik/console(32): Symfony\Component\Console\Application->run()
#10 {main}
[RuntimeException]
Not enough arguments.
database:optimize-archive-tables [–dry-run] dates1 … [datesN]
What’s wrong here?
thx, bye from Austria
Andreas
Lukas
(Lukas Winkler)
April 1, 2020, 10:24am
2
Hi,
That’s a weird one.
The OptimizeArchiveTables.php has not been touched since last summer, so there are no new undocumented command line parameters required.
My tip would be to edit the /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Input/Input.php
and var_dump the arguments to get a clue why there are too few.
/**
* Validates the input.
*
* @throws \RuntimeException When not enough arguments are given
*/
public function validate()
{
if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) {
throw new \RuntimeException('Not enough arguments.');
}
}
futureweb
(Andreas Schnederle-Wagner)
April 1, 2020, 10:29am
3
I seem to attract those weird ones …
var_dump() of $this->arguments
-bash-4.2$ /usr/bin/php /var/www/piwik/console database:optimize-archive-tables
Arg: array(1) {
["command"]=>
string(32) "database:optimize-archive-tables"
}
Lukas
(Lukas Winkler)
April 1, 2020, 11:02am
4
Hi,
Okay, it seems like the same happens when I try it.
Adding a var_dump($this->definition->getArguments());
indicates that two arguments would be expected.
And checking
protected function configure()
{
$this->setName('database:optimize-archive-tables');
$this->setDescription("Runs an OPTIMIZE TABLE query on the specified archive tables.");
$this->addArgument("dates", InputArgument::IS_ARRAY | InputArgument::REQUIRED,
"The months of the archive tables to optimize. Use '" . self::ALL_TABLES_STRING. "' for all dates or '" .
self::CURRENT_MONTH_STRING . "' to optimize the current month only.");
$this->addOption('dry-run', null, InputOption::VALUE_NONE, 'For testing purposes.');
$this->setHelp("This command can be used to ease or automate maintenance. Instead of manually running "
. "OPTIMIZE TABLE queries, the command can be used.\n\nYou should run the command if you find your "
. "archive tables grow and do not shrink after purging. Optimizing them will reclaim some space.");
}
there is indeed a required parameter called dates which is also confirmed by console database:optimize-archive-tables --help
.
As this required parameter exists since 5 years ago, running this command without specifying a date couldn’t have been working before.
futureweb
(Andreas Schnederle-Wagner)
April 1, 2020, 1:53pm
5
Hey @Lukas ,
you see me quite baffled I haven’t noticed yet that the Cron was not working properly …
Seems like I added the Cronjob on 16.11.2018 on advise by tsteur - but I just can’t figure out why I never realised it’s not working as expected as I normally dripple check everything …
opened 08:36AM - 15 Nov 18 UTC
Enhancement
c: Performance
Hey there,
since a few weeks (not 100% sure if it started when we updated to 3.… 6.1 but it seems like?!) my "core:archive" Cronjob is giving me a nightly" [Zend_Db_Statement_Mysqli_Exception] Mysqli prepare error: MySQL server has gone away" ...
- Cron is set to run hourly.
- MariaDB isn't restarted or something (and no Errors)
- no problems with Stats logging
From what I saw - it seems like sometimes the Cron is running into another long running "core:archive" Job which is causing troubles.
When this happens I see 2 long running SQL Threads doing:
OPTIMIZE TABLE piwik_archive_numeric_2012_01,piwik_archive_numeric_2012_02,piwik_archive_num...
Both waiting for "getting table lock" ... guess they stand out against each other ...
For now I try to extend Cron Times to 1.5 Hours and see if it helps ...
But woud it be possible to implement an "Archive Job already running" LOCK or something like that? Guess this should also help with such problems?
thx, bye from Austria
Andreas Schnederle-Wagner
Well … thank you, as so often, very much!
Bye out of Quarantine in sunny Tirol
Andreas
1 Like
Lukas
(Lukas Winkler)
April 1, 2020, 1:55pm
6
Hi,
Tip for the future:
add a
MAILTO="me@example.com"
line at the beginning of the the crontab file to get E-Mail notifications of failures (if a mailserver is set up).
Stay save and greetings from the other end of Austria!
1 Like
I have the same problem here. What is the solution now for this problem?
Lukas
(Lukas Winkler)
April 2, 2020, 11:28am
8
@rittershofer
The solution is to call console
with the correct paramters as indicated by --help
. In the case of database:optimize-archive-tables
you need to specify at least one date.
Problem solved - unclear help page. Thanks anyway.