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

Cohort sync task failure #2641

Closed
dragos5436 opened this issue Sep 27, 2024 · 3 comments · Fixed by #2642, #2643, #2644 or #2645
Closed

Cohort sync task failure #2641

dragos5436 opened this issue Sep 27, 2024 · 3 comments · Fixed by #2642, #2643, #2644 or #2645
Assignees
Labels
Issue type - bug Bugs in existing code that needs to be fixed. Plugin - local_o365 Status - PR ready / pending release Dev is done and PR ready. Will be included in the next release.
Milestone

Comments

@dragos5436
Copy link

dragos5436 commented Sep 27, 2024

Hi there,

I am creating a new issue as instructed by @weilai-irl on #2609.

Original message:

We have been experiencing the same Cohort sync task failure as above for a while now. It seems to be a scheduled task supposed to run every day. We discovered it after upgrading to Moodle 4.4.1 last week (an update in 4.4 pushes notifications to us now about these task failures). However, after checking the logs, it looks like the task has been failing every day since July 1st for us, so probably not related to the upgrade itself. Here is a failure message example (personal data has been removed):

 Execute scheduled task: Cohort sync (local_o365\task\cohortsync)
 ... started 14:08:41. Current memory use 13.6 MB.
 Debugging increased temporarily due to faildelay of 86400
 ... Start updating groups cache.
 ...... Added group ID 9a51bfae-90f2-44dd-8515-8f5ab61d10a4 to cache.
 ...... Added group ID 9a52bb34-1e34-42c5-b106-454b8b68e247 to cache.
 ... used 89361 dbqueries
 ... used 711.84796905518 seconds
 Scheduled task failed: Cohort sync (local_o365\task\cohortsync),Error writing to database (Data too long for column 'name' at row 1
 INSERT INTO mdl_local_o365_groups_cache (objectid,name,description) VALUES(?,?,?)
 [array (
   0 => 'b4725107-2fc0-4d83-aba6-d93181b260be',
   1 => 'username1@emailaddress; username2@emailaddress; username3@emailaddress; username4@emailaddress; username5@emailaddress; username6@emailaddress; username7@emailaddress; username8@emailaddress; username9@emailaddress',
   2 => NULL,
 )])
 Debug info:
 Data too long for column 'name' at row 1
 INSERT INTO mdl_local_o365_groups_cache (objectid,name,description) VALUES(?,?,?)
 [array (
   0 => 'b4725107-2fc0-4d83-aba6-d93181b260be',
   1 => 'username1@emailaddress; username2@emailaddress; username3@emailaddress; username4@emailaddress; username5@emailaddress; username6@emailaddress; username7@emailaddress; username8@emailaddress; username9@emailaddress',
   2 => NULL,
 )]
 Backtrace:
 * line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
 * line 1482 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
 * line 1528 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
 * line 244 of /local/o365/classes/feature/cohortsync/main.php: call to mysqli_native_moodle_database->insert_record()
 * line 72 of /local/o365/classes/task/cohortsync.php: call to local_o365\feature\cohortsync\main->update_groups_cache()
 * line 60 of /local/o365/classes/task/cohortsync.php: call to local_o365\task\cohortsync->execute_sync()
 * line 410 of /lib/classes/cron.php: call to local_o365\task\cohortsync->execute()
 * line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
 * line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
 * line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

Could you please investigate the cause of this task failure and provide a solution for fixing it?

Thank you.

Moodle version: 4.4.1
Microsoft plugins version:

  • auth_oidc: 2024042200
  • local_o365: 2024042200

PHP version: 8.1
Database version: MySQL 8.0.32

To answer your question @weilai-irl, yes, I have edited the email addresses listed after '1 =>' in the array above. I'm assuming these would go under the field 'name' in the mdl_local_o365_groups_cache table. I just checked the original error message and the total length of this entry is 256 characters.

@weilai-irl
Copy link
Collaborator

Copied from #2609 (comment):

Microsoft group names can take 256 character, while the Moodle database table to store the group cache can store 255. If you try to save group cache for a group with 256 characters in the name, you will see the error.

@weilai-irl
Copy link
Collaborator

Hi @dragos5436

The fix to the issue has been included in the release from yesterday. Please check it out.

Thank you again for reporting the issue.

Regards,
Lai

@dragos5436
Copy link
Author

Hi Lai,

Thank you very much for fixing it.

Regards,
Dragos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment