nextcloud / nextcloud/activity
Possible race condition between `EmailNotification` BG job and `occ activity:send-emails`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 145
- Forks
- 72
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 42
Description
https://docs.nextcloud.com/server/27/admin_manual/configuration_server/activity_configuration.html#better-scheduling-of-activity-emails recommends running occ activity:send-emails from cron.
Meanwhile there's no way (that I'm aware of) to disable the EmailNotification background job without also disabling the other background jobs.
So both code triggers are active and might run at the same time.
The email-sending code loops over a list of users that should receive an email, and after all that email sending is done, deletes all items from the affected users.
So if both, the background job and the cron job, run overlapping, they might send emails twice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/MailQueueHandler.php and the occ activity:send-emails entry point referenced in the issue. Reproduce or reason about overlapping runs of the EmailNotification background job and the cron command, then inspect the relevant tests or add coverage for concurrent execution. Done means overlapping triggers cannot send the same activity emails twice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100