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

Concurrency lock for scheduled tasks #17868

Closed
sgiehl opened this issue Aug 9, 2021 · 1 comment · Fixed by #21795
Closed

Concurrency lock for scheduled tasks #17868

sgiehl opened this issue Aug 9, 2021 · 1 comment · Fixed by #21795
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Data Integrity & Accuracy c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@sgiehl
Copy link
Member

sgiehl commented Aug 9, 2021

Currently a scheduled task can be triggered multiple times in parallel. As this can cause serious issues for tasks that manipulate data, we should provide some kind of concurrency lock for scheduled tasks to prevent that by default.

Simplest solution might be to create a Concurrency/Lock for each Task that is running. We could maybe use a default TTL of one hour, but allow each task to provide a custom TTL for that, so a longer running task can define a longer one.
This approach for sure wouldn't prevent concurrency for tasks that might run longer than the defined TTL. But it would at least prevent tasks being triggered multiple times.

To really avoid concurrency guess we would need to implement a more complex solution that really checks if a Task might be running in another process, but that might not be needed for now.

Note: there should also be a possibility to allow a task to be executed in parallel (maybe by setting the TTL to null or 0)

@sgiehl sgiehl added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Aug 9, 2021
@tsteur tsteur added this to the 4.7.0 milestone Aug 9, 2021
@tsteur
Copy link
Member

tsteur commented Nov 30, 2023

We've had an issue where we received the same alert email 8 times. refs matomo-org/plugin-CustomAlerts#155

refs #19287

@mattab mattab modified the milestones: 5.4.0, 5.1.0 Dec 10, 2023
@mattab mattab added c: Data Integrity & Accuracy Bug For errors / faults / flaws / inconsistencies etc. labels Dec 10, 2023
@sgiehl sgiehl added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jan 18, 2024
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. c: Data Integrity & Accuracy c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants