-
Notifications
You must be signed in to change notification settings - Fork 23
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
Error when executing adhoc-task \tool_dataprivacy\task\process_data_request_task #75
Comments
Even after killing the process of the adhoc task the mysqld process stays at 100% CPU load. |
Hey Martin, are you using MySQL or MariaDB and which version are you using? I would be surprised if it is important, but what php version are you using? Justus |
In the same vein, I get this error (luckily, sent by email) when exporting data for a privacy inspection. I am running the weekly stable build of Moodle (currently, this is 3.10.3+ (Build: 20210330)) and the latest release of the plugin (v3.10-r1 - 2020111300), using PostgreSQL (11.11 under Debian) and PHP 7.3.27-1. Beim Aufruf von mod_moodleoverflow\privacy\provider::get_contexts_for_userid ist ein Fehler aufgetreten. Fehler beim Lesen der Datenbank #0 /opt/moodle/moodle-git-stable/lib/dml/pgsql_native_moodle_database.php(329): moodle_database->query_end(false) |
We are using MariaDB: For moodle we use php7.4-fpm. |
Thank you both for your information. Sadly, I couldn't reproduce the problem. Could you (temporarily) replace Lines 182 and 183 in global $DB;
$DB->set_debug(true);
try {
$contextlist = new \core_privacy\local\request\contextlist();
$contextlist->add_from_sql($sql, $params);
} finally {
$DB->set_debug(false);
} |
Hi, Fehler beim Lesen der Datenbank #0 /opt/moodle/moodle-git-stable/lib/dml/pgsql_native_moodle_database.php(329): moodle_database->query_end(false) |
Hi @roessling Yes, I think so too, that's why I try to get more information about the database access in |
Okay, I changed the lines as you said.
The request is indeed from the user with ID 411. |
Thanks @mputzi , and sorry for the delay. |
I think the problem will only occur if the person who requests the information who has also written something in a moodleoverflow. As these are used only very sparingly in my Moodle instance (and we only get a negligible number of privacy requests), the problem has not reappeared - but that does not necessarily mean it's "gone". When I run the query from above manually (inserting all values into the placeholders, and running it via "Moodle Adminer"), I get "No rows" (which may be correct, see above), but no error. |
@justusdieckmann did you checked with a person writing a post? If that is the case, I suppose we are not really able to reproduce the error. |
We encountered the same error, and the same SQL query seemed involved. We try to together more data. moodle 3.11.13 |
The query runs for a very long time. Obtaining the query execution plan gives the following answer. Looks expensive.
|
Sounds reasonable, does anybody has resources to optimize the query? |
ah is SpaceCafe related to you? |
No :) |
We had this issue a "long" time ago (~1y) and used this fix in production |
The fix is faster, but it's still taking more than 8 minutes to return an empty set.
|
How about the following query? SELECT c.id
FROM mdl_context c
INNER JOIN mdl_course_modules cm ON cm.id = c.instanceid AND c.contextlevel = '70'
INNER JOIN mdl_modules m ON m.id = cm.module AND m.name = 'moodleoverflow'
INNER JOIN mdl_moodleoverflow mof ON mof.id = cm.instance
WHERE EXISTS (
SELECT 1 FROM mdl_moodleoverflow_discussions d WHERE d.moodleoverflow = mof.id AND (d.userid = '25778' OR d.usermodified = '25778')
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_posts p WHERE p.discussion IN (SELECT id FROM mdl_moodleoverflow_discussions WHERE moodleoverflow = mof.id) AND p.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_read r WHERE r.moodleoverflowid = mof.id AND r.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_subscriptions s WHERE s.moodleoverflow = mof.id AND s.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_discuss_subs ds WHERE ds.moodleoverflow = mof.id AND ds.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_ratings ra WHERE ra.moodleoverflowid = mof.id AND ra.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_tracking track WHERE track.moodleoverflowid = mof.id AND track.userid = '25778'
) OR EXISTS (
SELECT 1 FROM mdl_moodleoverflow_grades g WHERE g.moodleoverflowid = mof.id AND g.userid = '25778'
); |
EXPLAIN looks a lot better:
And the execution time is down to milliseconds. |
moodle 3.10.3+
moodleoverflow v3.10-r1 (2020111300)
Steps to reproduce:
AdHoc-Task \tool_dataprivacy\task\process_data_request_task started (and replicated to number of max allowed concurrent AdHoc-Tasks).
Tasks fails at moodleoverflow-plugin
-> mysqld-process at 100% CPU (3 times) -> server is slowed down
There is no way of stopping or deleting this adhoc-Task from graphical moodle interface.
output when starting via cli:
nothing more.
The process is not finishing and is not being terminated or killed automatically after max execution time for AdHoc-Tasks.
Please help.
Regards,
Martin.
The text was updated successfully, but these errors were encountered: