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

Uncaught exception: Date.php: The date '1970-01-01' is a date before first website was online. #16937

Closed
habakuk007 opened this issue Dec 11, 2020 · 5 comments · Fixed by #16957
Assignees

Comments

@habakuk007
Copy link

habakuk007 commented Dec 11, 2020

Hello,

since the update to 4.0.5 I get these error message from cron (and also in the web ui):

ERROR [2020-12-11 11:00:12] 4020 Uncaught exception: core/Date.php(160): The date '1970-01-01' is a date before first website was online. Try date that's after Aug 6, 1991 (timestamp 681436800).: 2
The date '1970-01-01' is a date before first website was online. Try date that's after Aug 6, 1991 (timestamp 681436800).: 2

[Exception]
The date '1970-01-01' is a date before first website was online. Try date that's after Aug 6, 1991 (timestamp 681436800).: 2

core:archive [--url="..."] [--skip-idsites[="..."]] [--skip-all-segments] [--force-idsites[="..."]] [--skip-segments-today] [--force-periods[="..."]] [--force-date-last-n="..."] [--force-date-range[="..."]] [--force-idsegments="..."] [--concurrent-requests-per-website[="..."]] [--concurrent-archivers[="..."]] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--php-cli-options[="..."]] [--force-all-websites]

The version I had before the update was probably 4.0.3 and it worked for several years now.

I use this instance of matomo not for the tracking of software usage, not for websites.

Matomo-Version: 4.0.5
MySQL-Version: 10.3.25-MariaDB
PHP-Version: 7.4.13

Any ideas?

Regards!
Stefan

@tsteur
Copy link
Member

tsteur commented Dec 14, 2020

@diosmosis do you have maybe any idea?

@diosmosis
Copy link
Member

Looks like something is doing new Date(2), which seems rather strange. Only thing I can think of is a timestamp in the archive table being off or having to deal w/ some other strange data.

@habakuk007 could you run the command with -vvv (ie, ./console core:archive -vvv) and post the result?

@diosmosis diosmosis self-assigned this Dec 14, 2020
@habakuk007
Copy link
Author

habakuk007 commented Dec 14, 2020

Hello @diosmosis,

thanks for your answer!

If I run ./console core:archive -vvv I still get the error Uncaught exception: Date.php(160): The date '1970-01-01' is a date before first website was online. (see
output.txt

Trace:

Exception trace:
() at /var/www/virtual/u/html/core/Date.php:160
Piwik\Date::factory() at /var/www/virtual/u/html/core/ArchiveProcessor/Loader.php:441
Piwik\ArchiveProcessor\Loader->getMinVisitTimesPerSite() at /var/www/virtual/u/html/core/ArchiveProcessor/Loader.php:413
Piwik\ArchiveProcessor\Loader->hasSiteVisitsBetweenTimeframe() at /var/www/virtual/u/html/core/ArchiveProcessor/Loader.php:365
Piwik\ArchiveProcessor\Loader->canSkipThisArchive() at /var/www/virtual/u/html/core/CronArchive.php:864
Piwik\CronArchive->invalidateRecentDate() at /var/www/virtual/u/html/core/CronArchive.php:808
Piwik\CronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain() at /var/www/virtual/u/html/core/CronArchive/QueueConsumer.php:160
Piwik\CronArchive\QueueConsumer->getNextArchivesToProcess() at /var/www/virtual/u/html/core/CronArchive.php:367
Piwik\CronArchive->run() at /var/www/virtual/u/html/core/CronArchive.php:262
Piwik\CronArchive->Piwik{closure}() at /var/www/virtual/u/html/core/Access.php:664
Piwik\Access::doAsSuperUser() at /var/www/virtual/u/html/core/CronArchive.php:268
Piwik\CronArchive->main() at /var/www/virtual/u/html/plugins/CoreConsole/Commands/CoreArchiver.php:27
Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute() at /var/www/virtual/u/html/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at /var/www/virtual/u/html/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at /var/www/virtual/u/html/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at n/a:n/a
call_user_func() at /var/www/virtual/u/html/core/Console.php:130
Piwik\Console->Piwik{closure}() at /var/www/virtual/u/html/core/Access.php:673
Piwik\Access::doAsSuperUser() at /var/www/virtual/u/html/core/Console.php:131
Piwik\Console->doRunImpl() at /var/www/virtual/u/html/core/Console.php:82
Piwik\Console->doRun() at /var/www/virtual/u/html/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/www/virtual/u/html/console:32

I also get this error in the UI (but here only for a test instance, that probably uses dates like '1970-01-01'):

grafik

Regards!
Stefan

@diosmosis
Copy link
Member

@habakuk007 this should be fixed by #16957, would you be able to confirm? It seems that you have a visit with a timestamp of 2 (2 seconds past the posix epoch).

@habakuk007
Copy link
Author

Hello @diosmosis,

I applied the changes from #16957 to the Loader.php on my server and now it works again.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants