Has Ghostscript something to do with a half a million lock files?

Re: Has Ghostscript something to do with a half a million lock files?

by Ken Task -
Number of replies: 1
Picture of Particularly helpful Moodlers

Ok, some more 'exploring' ...

Site is a 3.8.highest sandbox so not as much usage as a 'normal site'.

added to config.php

$CFG->lock_factory = "\\core\\lock\\db_record_lock_factory";

manually removed all files from moodledata/lock/

As root user ran cron.php from admin/cli/ ... no errors.

Then checked mdl_lock_db table:

mysql> select * from mdl_lock_db;
+----+---------------------------------------------------------+---------+-------+
| id | resourcekey                                             | expires | owner |
+----+---------------------------------------------------------+---------+-------+
|  1 | cron_scheduled_task_runner_0                            |    NULL | NULL  |
|  2 | cron_\auth_mnet\task\cron_task                          |    NULL | NULL  |
|  3 | cron_\enrol_category\task\enrol_category_sync           |    NULL | NULL  |
|  4 | cron_\enrol_flatfile\task\flatfile_sync_task            |    NULL | NULL  |
|  5 | cron_\enrol_imsenterprise\task\cron_task                |    NULL | NULL  |
|  6 | cron_\enrol_lti\task\sync_grades                        |    NULL | NULL  |
|  7 | cron_\enrol_lti\task\sync_members                       |    NULL | NULL  |
|  8 | cron_\enrol_meta\task\enrol_meta_sync                   |    NULL | NULL  |
|  9 | cron_\enrol_paypal\task\process_expirations             |    NULL | NULL  |
| 10 | cron_\repository_dropbox\task\cron_task                 |    NULL | NULL  |
| 11 | cron_\repository_onedrive\remove_temp_access_task       |    NULL | NULL  |
| 12 | cron_\logstore_legacy\task\cleanup_task                 |    NULL | NULL  |
| 13 | cron_\core\task\session_cleanup_task                    |    NULL | NULL  |
| 14 | cron_core_cron                                          |    NULL | NULL  |
| 15 | cron_\core\task\send_new_user_passwords_task            |    NULL | NULL  |
| 16 | cron_\core\task\send_failed_login_notifications_task    |    NULL | NULL  |
| 17 | cron_\core\task\legacy_plugin_cron_task                 |    NULL | NULL  |
| 18 | cron_\core\task\grade_cron_task                         |    NULL | NULL  |
| 19 | cron_\core\task\completion_regular_task                 |    NULL | NULL  |
| 20 | cron_\core\task\portfolio_cron_task                     |    NULL | NULL  |
| 21 | cron_\core\task\plagiarism_cron_task                    |    NULL | NULL  |
| 22 | cron_\core\task\calendar_cron_task                      |    NULL | NULL  |
| 23 | cron_\core\task\blog_cron_task                          |    NULL | NULL  |
| 24 | cron_\core\task\question_preview_cleanup_task           |    NULL | NULL  |
| 25 | cron_\core\task\question_stats_cleanup_task             |    NULL | NULL  |
| 26 | cron_\mod_assign\task\cron_task                         |    NULL | NULL  |
| 27 | cron_\mod_forum\task\cron_task                          |    NULL | NULL  |
| 28 | cron_\mod_quiz\task\update_overdue_attempts             |    NULL | NULL  |
| 29 | cron_\mod_quiz\task\legacy_quiz_reports_cron            |    NULL | NULL  |
| 30 | cron_\mod_quiz\task\legacy_quiz_accessrules_cron        |    NULL | NULL  |
| 31 | cron_\mod_workshop\task\cron_task                       |    NULL | NULL  |
| 32 | cron_\mod_workshop\task\legacy_workshop_allocation_cron |    NULL | NULL  |
| 33 | cron_\repository_filesystem\task\cron_task              |    NULL | NULL  |
| 34 | cron_\tool_messageinbound\task\pickup_task              |    NULL | NULL  |
| 35 | cron_\tool_monitor\task\clean_events                    |    NULL | NULL  |
| 36 | cron_\workshopallocation_scheduled\task\cron_task       |    NULL | NULL  |
| 37 | cron_adhoc_task_runner_0                                |    NULL | NULL  |
| 38 | cron_\quiz_statistics\task\quiz_statistics_cleanup      |    NULL | NULL  |
| 39 | cron_\tool_cohortroles\task\cohort_role_sync            |    NULL | NULL  |
+----+---------------------------------------------------------+---------+-------+
39 rows in set (0.00 sec)

logged onto site ... clicked around some ... changed no config, etc.

Did same query after and now the output is as:

mysql> select * from mdl_lock_db;
+----+---------------------------------------------------------+---------+-------+
| id | resourcekey                                             | expires | owner |
+----+---------------------------------------------------------+---------+-------+
|  1 | cron_scheduled_task_runner_0                            |    NULL | NULL  |
|  2 | cron_\auth_mnet\task\cron_task                          |    NULL | NULL  |
|  3 | cron_\enrol_category\task\enrol_category_sync           |    NULL | NULL  |
|  4 | cron_\enrol_flatfile\task\flatfile_sync_task            |    NULL | NULL  |
|  5 | cron_\enrol_imsenterprise\task\cron_task                |    NULL | NULL  |
|  6 | cron_\enrol_lti\task\sync_grades                        |    NULL | NULL  |
|  7 | cron_\enrol_lti\task\sync_members                       |    NULL | NULL  |
|  8 | cron_\enrol_meta\task\enrol_meta_sync                   |    NULL | NULL  |
|  9 | cron_\enrol_paypal\task\process_expirations             |    NULL | NULL  |
| 10 | cron_\repository_dropbox\task\cron_task                 |    NULL | NULL  |
| 11 | cron_\repository_onedrive\remove_temp_access_task       |    NULL | NULL  |
| 12 | cron_\logstore_legacy\task\cleanup_task                 |    NULL | NULL  |
| 13 | cron_\core\task\session_cleanup_task                    |    NULL | NULL  |
| 14 | cron_core_cron                                          |    NULL | NULL  |
| 15 | cron_\core\task\send_new_user_passwords_task            |    NULL | NULL  |
| 16 | cron_\core\task\send_failed_login_notifications_task    |    NULL | NULL  |
| 17 | cron_\core\task\legacy_plugin_cron_task                 |    NULL | NULL  |
| 18 | cron_\core\task\grade_cron_task                         |    NULL | NULL  |
| 19 | cron_\core\task\completion_regular_task                 |    NULL | NULL  |
| 20 | cron_\core\task\portfolio_cron_task                     |    NULL | NULL  |
| 21 | cron_\core\task\plagiarism_cron_task                    |    NULL | NULL  |
| 22 | cron_\core\task\calendar_cron_task                      |    NULL | NULL  |
| 23 | cron_\core\task\blog_cron_task                          |    NULL | NULL  |
| 24 | cron_\core\task\question_preview_cleanup_task           |    NULL | NULL  |
| 25 | cron_\core\task\question_stats_cleanup_task             |    NULL | NULL  |
| 26 | cron_\mod_assign\task\cron_task                         |    NULL | NULL  |
| 27 | cron_\mod_forum\task\cron_task                          |    NULL | NULL  |
| 28 | cron_\mod_quiz\task\update_overdue_attempts             |    NULL | NULL  |
| 29 | cron_\mod_quiz\task\legacy_quiz_reports_cron            |    NULL | NULL  |
| 30 | cron_\mod_quiz\task\legacy_quiz_accessrules_cron        |    NULL | NULL  |
| 31 | cron_\mod_workshop\task\cron_task                       |    NULL | NULL  |
| 32 | cron_\mod_workshop\task\legacy_workshop_allocation_cron |    NULL | NULL  |
| 33 | cron_\repository_filesystem\task\cron_task              |    NULL | NULL  |
| 34 | cron_\tool_messageinbound\task\pickup_task              |    NULL | NULL  |
| 35 | cron_\tool_monitor\task\clean_events                    |    NULL | NULL  |
| 36 | cron_\workshopallocation_scheduled\task\cron_task       |    NULL | NULL  |
| 37 | cron_adhoc_task_runner_0                                |    NULL | NULL  |
| 38 | cron_\quiz_statistics\task\quiz_statistics_cleanup      |    NULL | NULL  |
| 39 | cron_\tool_cohortroles\task\cohort_role_sync            |    NULL | NULL  |
| 40 | cron_\core\task\delete_incomplete_users_task            |    NULL | NULL  |
| 41 | cron_\core\task\badges_cron_task                        |    NULL | NULL  |
| 42 | cron_\core\task\badges_message_task                     |    NULL | NULL  |
| 43 | cron_\mod_chat\task\cron_task                           |    NULL | NULL  |
| 44 | cron_\mod_scorm\task\cron_task                          |    NULL | NULL  |
| 45 | cron_\block_rss_client\task\refreshfeeds                |    NULL | NULL  |
+----+---------------------------------------------------------+---------+-------+
45 rows in set (0.00 sec)

note from 39 rows to 45 rows.

Ran cron.php from command line as root user.

No errors and rows have been added to table

| 46 | cron_\core\task\backup_cleanup_task                     |    NULL | NULL  |
| 47 | cron_\enrol_cohort\task\enrol_cohort_sync               |    NULL | NULL  |
| 48 | cron_\enrol_manual\task\sync_enrolments                 |    NULL | NULL  |
| 49 | cron_\enrol_manual\task\send_expiry_notifications       |    NULL | NULL  |
| 50 | cron_\enrol_self\task\sync_enrolments                   |    NULL | NULL  |
| 51 | cron_\enrol_self\task\send_expiry_notifications         |    NULL | NULL  |
| 52 | cron_\assignfeedback_editpdf\task\convert_submissions   |    NULL | NULL  |
+----+---------------------------------------------------------+---------+-------+
52 rows in set (0.00 sec)

cron job on this site is running as per recommendations ... 1 time per minute.

So lock is directly related to cron jobs and task list as well as modules used.  *and there are no files in moodledata/lock/ *

Guess I might have to tinker in the site with stuff ... wait a day to see what changes.

Am guessing that once all the task that are turned on will eventually have an entry/row in the DB table and it won't grow ... but update a row.

If you are *brave*, you could do same on your site with issues ... if DB is in good shape.   That would end the inode issues in moodledata/lock/.  Could easily turn it back to old behavior by removing the added line in config.php.

'SoS', Ken

In reply to Ken Task

Re: Has Ghostscript something to do with a half a million lock files?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Ken

Thanks for the deep-dive in to the "lock factory". Went in to details and couldn't find anything suspicious. The task processing from the GUI, now I am a Moodle admin too, all seem to be clean. And no new lock files appear, Moodle has not even created the moodledata/lock/ directory. I would say no need to go the "lock" path any further.

Instead the focus has shifted to two things: The one thing related to the OP is, I need to check how the sea of PDF files, some 118 k, are related to the 420 k PNG files. I believe they are related, PNGs are the individual pages of PDFs. Whether they are clean in the sense that the PDF annotator still works. The other thing is missing files, files which are recorded in Moodle but missing in filedir/. Will have a look. Will open a new thread if necessary.

Many thanks and pl. accept a boat load of good Karma from the "customers" (a state institution I was helping pro bono).