I have been having a number of issues caused (I think) by the the data privacy tool.
The symptom seems to be that cron tasks do not finish.
Execute adhoc task: tool_dataprivacy\task\process_data_request_task continues to fail.
This has resulted in a number of odd issues I think.
The data request task ends in the preprocessing stage:
Pre-processing request... Fetching data from 494 components (Friday, 11 October 2019, 3:28 PM) Processing antivirus_clamav (1/494) (Friday, 11 October 2019, 3:28 PM) ....
Processing mod_journal (40/494) (Friday, 11 October 2019, 3:28 PM)I have noticed that there are old journal entries for deleted users (for courses that were never reset, but are still be used).
The most major problem was that forum email notifications would not send. Also Data Requests never seem to finish processing. Thus I have users whose data requests are always "processing" or "approved" but never finish.
I have "solved" this by emptying (or deleting users) in the database directly in the table: mdl_tool_dataprivacy_request. When I run Cron manually, I get an error that users cannot be found, and then after a minute or so (other scheduled task likely run), the manual cron runs without incident and the moodle seems to work just fine (no data requests processing, forum mail sends, etc...)
I am using moodle 3.7.2. The issue seems to have occurred when I upgraded to 3.7.1 or with the migration of our moodle from a VPS I operated to a hosted site. Thus I am not sure whether the issue is a configuration/conflict issue in the new hosted environment or a bug caused perhaps by either my privacy configuration or the number of assignments/journal entries which had been orphaned as users were removed in August.
I do recall having a similar "forum notifications not being sent" issue with database locks in the past - but that was fixed with $CFG->lock_factory = "\\core\\lock\\db_record_lock_factory"; in 2017.
Any help on this would be useful. My "fix" is likely not good for my moodle, but it has worked and no other suggestions in any posts have worked.
Theses are some of the related posts I have found: