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

Exceptions when running Recalculate question statistics scheduled task

    XMLWordPrintable

Details

    • MOODLE_400_STABLE, MOODLE_401_STABLE

    Description

      After upgrading one of our Moodle 3.11 site up to Moodle 4.0 there is a scheduled task that constandtly failing. This might be either because of bad data in DB or some hidden Moodle bug(s).

      I wasn't able to find an exsting Moodle tracker so if there any please feel free to close this as a duplicate and post a link to the original tracker.

      There are 106 exceptions we encounter. They can be devided into 4 types:

      Type A - don't understand this yet. -> moved to a new issue MDL-77381

      Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays
       
      Error code: codingerror
       
      * line 770 of /lib/dml/moodle_database.php: coding_exception thrown
      * line 441 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->get_in_or_equal()
      * line 564 of /question/engine/datalib.php: call to pgsql_native_moodle_database->get_in_or_equal()
      * line 294 of /question/classes/statistics/questions/calculator.php: call to question_engine_data_mapper->load_questions_usages_latest_steps()
      * line 96 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\calculator->get_latest_steps()
      * line 650 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->calculate()
      * line 941 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
      * line 105 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
      * line 253 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
      * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      Type B - related to qtype_multianswer -> moved to new issue MDL-78008

      Coding error detected, it must be fixed by a programmer: Unknown question type subquestion_replacement
       
      Error code: codingerror
       
      * line 95 of /question/engine/bank.php: coding_exception thrown
      * line 319 of /question/type/multianswer/questiontype.php: call to question_bank::get_qtype()
      * line 471 of /question/classes/statistics/questions/calculator.php: call to qtype_multianswer->get_random_guess_score()
      * line 162 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\calculator->get_random_guess_score()
      * line 650 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->calculate()
      * line 941 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
      * line 105 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
      * line 253 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
      * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      Type C - duplicate of MDL-76843 - I won't consider this further here.

      Error reading from database
       
      ERROR:  invalid input syntax for type bigint: "s1794781"
      CONTEXT:  unnamed portal parameter $1 = '...'
      SELECT q.*,
                         qc.id as category,
                         qv.status,
                         qv.id as versionid,
                         qv.version,
                         qv.questionbankentryid,
                         qc.contextid as contextid
                         
                    FROM mdl_question q
                    JOIN mdl_question_versions qv
                      ON qv.questionid = q.id
                    JOIN mdl_question_bank_entries qbe
                      ON qbe.id = qv.questionbankentryid
                    JOIN mdl_question_categories qc
                      ON qc.id = qbe.questioncategoryid
                    
                    WHERE q.id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)
                    
      [array (
        0 => 's1794781',
        1 => 's1794780',
        2 => '16880965',
        3 => '16880966',
        4 => '16880955',
        5 => '16880957',
        6 => '16880959',
        7 => '16880961',
        8 => '16880958',
        9 => '16880956',
        10 => '16880934',
        11 => '16880932',
        12 => '16880931',
        13 => '16880962',
      )]
      Error code: dmlreadexception
       
      * line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
      * line 291 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
      * line 338 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
      * line 1017 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      * line 905 of /lib/questionlib.php: call to pgsql_native_moodle_database->get_records_sql()
      * line 924 of /lib/questionlib.php: call to question_preload_questions()
      * line 852 of /mod/quiz/report/statistics/report.php: call to question_load_questions()
      * line 939 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
      * line 105 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
      * line 253 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
      * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      Type D - infinite Random guess score from a multianswer question, see replication steps described in MDL-77378

      Error writing to database
       
      ERROR:  numeric field overflow
      DETAIL:  A field with precision 12, scale 7 cannot hold an infinite value.
      INSERT INTO mdl_question_statistics (hashcode,timemodified,questionid,slot,subquestion,s,effectiveweight,negcovar,discriminationindex,discriminativeefficiency,sd,facility,subquestions,maxmark,positions,randomguessscore,variant) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17) 
      [array (
        'hashcode' => '63b8150b9998197bf4af7909c6ebcd6d57ce421f',
        'timemodified' => 1674968969,
        'questionid' => '20660117',
        'slot' => 14,
        'subquestion' => 0,
        's' => 5,
        'effectiveweight' => NULL,
        'negcovar' => 0,
        'discriminationindex' => NULL,
        'discriminativeefficiency' => NULL,
        'sd' => 0.0,
        'facility' => NULL,
        'subquestions' => '',
        'maxmark' => '0.0000000',
        'positions' => 12,
        'randomguessscore' => INF,
        'variant' => NULL,
      )]
      Error code: dmlwriteexception
       
      * line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
      * line 291 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
      * line 338 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
      * line 1122 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      * line 1170 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      * line 231 of /question/classes/statistics/questions/calculated.php: call to pgsql_native_moodle_database->insert_record()
      * line 259 of /question/classes/statistics/questions/all_calculated_for_qubaid_condition.php: call to core_question\statistics\questions\calculated->cache()
      * line 258 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\all_calculated_for_qubaid_condition->cache()
      * line 650 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->calculate()
      * line 941 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
      * line 105 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
      * line 253 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
      * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mikhailgolenkov Misha Golenkov
              Votes:
              11 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.