Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64846

Daily issues with Duplicate entry for 'mdl_courcomp_usecou_uix'

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Environment:  Running 3.5 (Build: 20180517)mysql (5.7.22), PHP 7.0.30, Ubuntu, Edweiser RemUI

      I posted earlier in forums without a response and have searched through the tracker and do not see the issue that I am experiencing. All other tracker issues that may be close are for restoring backups, etc, not the day to day use of Moodle.  This problem is increasing as the usage increases.

      I have daily issues with the course completion timestamp intermittently not posting to the mdl_course_completion table.  For example:  61 course completions over 12 hours.  13 of the completions error out (see below) and then disappear and don’t post to the mdl_course_completions.timecompleted, 48 during the same 12 hours post successfully.

      Note:  The Calculate regular completion scheduled task is running as are other tasks and are operating. 

      The debug message for a manual run of the completion task for one user that is erroring:

      Execute scheduled task: Calculate regular completion data (core\task\completion_regular_task)

      ... started 14:36:51. Current memory use 9.8MB.

      Running completion_criteria_date->cron()

      Running completion_criteria_activity->cron()

      Running completion_criteria_duration->cron()

      Running completion_criteria_grade->cron()

      ... used 8 dbqueries

      ... used 0.084294080734253 seconds

      Scheduled task failed: Calculate regular completion data (core\task\completion_regular_task),Error writing to database

      Debug info:

      Duplicate entry '823-20' for key 'mdl_courcomp_usecou_uix'

      INSERT INTO mdl_course_completions (userid,course,timeenrolled,timestarted,timecompleted,reaggregate) VALUES(?,?,?,?,?,?)

      [array (

        0 => '823',

        1 => '20',

        2 => 0,

        3 => '1550000211',

        4 => NULL,

        5 => 1550000211,

      )]

      Backtrace:

      • line 1300 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1346 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 334 of /completion/data_object.php: call to mysqli_native_moodle_database->insert_record()
      • line 206 of /completion/completion_completion.php: call to data_object->insert()
      • line 142 of /completion/completion_completion.php: call to completion_completion->_save()
      • line 123 of /completion/completion_criteria_completion.php: call to completion_completion->mark_inprogress()
      • line 234 of /completion/criteria/completion_criteria_grade.php: call to completion_criteria_completion->mark_complete()
      • line 205 of /completion/cron.php: call to completion_criteria_grade->cron()
      • line 52 of /lib/classes/task/completion_regular_task.php: call to completion_cron_criteria()
      • line 105 of /lib/cronlib.php: call to core\task\completion_regular_task->execute()
      • line 297 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      • line 91 of /admin/tool/task/schedule_task.php: call to cron_run_single_task()

      The user does not have a timecompleted timestamp posted  the the reaggregate field has a value greater then 0 in the table.  After the cron runs (and errors) a few times, the data is lost and I have to generate a UNIX timestamp to post to the completions table for it to register. 

      This error blocks other completions from posting to the table until it clears. I’m not sure what eventually clears the error.  The completions will post again until the next time the error occurs.  

      Any ideas as to what may be causing this issue?  

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            mpasterchik Margaret Pasterchik
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: