@tsteur opened this Issue on September 8th 2021 Member

See https://github.com/matomo-org/matomo/commit/af44ee1de20bd2f9ace63e7f69f2312c08cfa61e#diff-f41c275e883996b8b69cb765b1818e12e82cbe034e648bc3f7d03610cc7abad1R449-R456

The trigger=archivephp flag will cause scheduled tasks to allow archiving. Seems this hack was needed for purgeOutdatedArchives to work. We should fix this issue so that scheduled tasks won't launch archiving when browser archiving is disabled.

This can otherwise cause many tasks to become very slow (including scheduled reports, custom alerts, some on the cloud). And it can cause issues with other archives that were invalidated in the sense that for example some reports might be archived multiple times or that they are archived in the wrong order and therefore causes results to be wrong under circumstances. Because usually the archiver makes sure to first run all daily archives, then the weekly, then ... vs this way there might be race conditions or other problems maybe.

@peterhashair commented on October 6th 2021 Contributor

@tsteur sorry to bother, If I understand correctly, this issue is differentiating the CLI and the browser request on Archives jobs. When the browser triggers it, it should pass the setting already set by the admin. But through CLI it won't need that check?

@tsteur commented on October 6th 2021 Member

I'm not sure if it will need that check or not on CLI. That would be part of the issue to figure that out. Generally it be great if we could remove this line $_GET['trigger'] = 'archivephp'; completely. Or if it was added for purgeOutdatedArchives, maybe it could be set only in that task and then unset again if it did not already exist before that.

I would probably start with removing $_GET['trigger'] = 'archivephp'; completely and checking if tests still pass. If that's the case, I would look into why purgeOutdatedArchives could possibly need that flag to trigger archiving and whether it might be safe to just completely remove it.

The goal will be to not have trigger=archivephp during scheduled tasks as this can have unexpected consequences like all tasks triggering archiving etc.

@Starker3 commented on November 29th 2021 Contributor

@tsteur Would this completely prevent scheduled tasks from triggering archiving for specific plugins? For example a user recently had an issue where the IP2Company plugin was launching archiving when the scheduled tasks executed. Due to the configuration of the plugin it seems to rely only on archiving triggered by the scheduled task.

@tsteur commented on November 30th 2021 Member

Would this completely prevent scheduled tasks from triggering archiving for specific plugins

AFAIK yes it would stop that. Plugins shouldn't archive data during scheduled task as this can have big performance and memory implications. The plugin could probably workaround it by setting $_GET['trigger'] = 'archivephp'; in the scheduled task (and ideally unset it after it's finished)

This Issue was closed on October 8th 2021
Powered by GitHub Issue Mirror