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

Duplicate index error during behat run

XMLWordPrintable

    • MOODLE_31_STABLE

      I found these in my logs during a behat run:

      [Wed May 04 10:43:13.409488 2016] [:error] [pid 5672] [client 127.0.0.1:55004] Default exception handler: Error writing to database Debug: ERROR:  duplicate key value violates unique constraint "zbehat_file_pat_uix"\nDETAIL:  Key (pathnamehash)=(74c104d54c05b5f8c633a36da516d37e6c5279e4) already exists.\nINSERT INTO zbehat_files (contextid,component,filearea,itemid,filepath,filename,contenthash,filesize,timecreated,timemodified,mimetype,userid,pathnamehash) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13) RETURNING id\n[array (\n  'contextid' => 1,\n  'component' => 'core',\n  'filearea' => 'preview',\n  'itemid' => 0,\n  'filepath' => '/thumb/',\n  'filename' => '.',\n  'contenthash' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',\n  'filesize' => 0,\n  'timecreated' => 1462329793,\n  'timemodified' => 1462329793,\n  'mimetype' => NULL,\n  'userid' => NULL,\n  'pathnamehash' => '74c104d54c05b5f8c633a36da516d37e6c5279e4',\n)]\nError code: dmlwriteexception\n* line 477 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* line 898 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* line 954 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()\n* line 1044 of /lib/filestorage/file_storage.php: call to pgsql_native_moodle_database->insert_record()\n* line 1468 of /lib/filestorage/file_storage.php: call to file_storage->create_directory()\n* line 499 of /lib/filestorage/file_storage.php: call to file_storage->create_file_from_string()\n* line 303 of /lib/filestorage/file_storage.php: call to file_storage->create_file_preview()\n* line 2238 of /lib/filelib.php: call to file_storage->get_file_preview()\n* line 88 of /draftfile.php: call to send_stored_file()\n, referer: http://localhost/sm/admin/settings.php?section=assignfeedback_editpdf
      [Wed May 04 10:43:13.409703 2016] [:error] [pid 22566] [client 127.0.0.1:55005] Default exception handler: Error writing to database Debug: ERROR:  duplicate key value violates unique constraint "zbehat_file_pat_uix"\nDETAIL:  Key (pathnamehash)=(74c104d54c05b5f8c633a36da516d37e6c5279e4) already exists.\nINSERT INTO zbehat_files (contextid,component,filearea,itemid,filepath,filename,contenthash,filesize,timecreated,timemodified,mimetype,userid,pathnamehash) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13) RETURNING id\n[array (\n  'contextid' => 1,\n  'component' => 'core',\n  'filearea' => 'preview',\n  'itemid' => 0,\n  'filepath' => '/thumb/',\n  'filename' => '.',\n  'contenthash' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',\n  'filesize' => 0,\n  'timecreated' => 1462329793,\n  'timemodified' => 1462329793,\n  'mimetype' => NULL,\n  'userid' => NULL,\n  'pathnamehash' => '74c104d54c05b5f8c633a36da516d37e6c5279e4',\n)]\nError code: dmlwriteexception\n* line 477 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* line 898 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* line 954 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()\n* line 1044 of /lib/filestorage/file_storage.php: call to pgsql_native_moodle_database->insert_record()\n* line 1468 of /lib/filestorage/file_storage.php: call to file_storage->create_directory()\n* line 499 of /lib/filestorage/file_storage.php: call to file_storage->create_file_from_string()\n* line 303 of /lib/filestorage/file_storage.php: call to file_storage->create_file_preview()\n* line 2238 of /lib/filelib.php: call to file_storage->get_file_preview()\n* line 88 of /draftfile.php: call to send_stored_file()\n, referer: http://localhost/sm/admin/settings.php?section=assignfeedback_editpdf
      [Wed May 04 10:43:13.416440 2016] [:error] [pid 21793] [client 127.0.0.1:55003] Default exception handler: Error writing to database Debug: ERROR:  duplicate key value violates unique constraint "zbehat_file_pat_uix"\nDETAIL:  Key (pathnamehash)=(74c104d54c05b5f8c633a36da516d37e6c5279e4) already exists.\nINSERT INTO zbehat_files (contextid,component,filearea,itemid,filepath,filename,contenthash,filesize,timecreated,timemodified,mimetype,userid,pathnamehash) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13) RETURNING id\n[array (\n  'contextid' => 1,\n  'component' => 'core',\n  'filearea' => 'preview',\n  'itemid' => 0,\n  'filepath' => '/thumb/',\n  'filename' => '.',\n  'contenthash' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',\n  'filesize' => 0,\n  'timecreated' => 1462329793,\n  'timemodified' => 1462329793,\n  'mimetype' => NULL,\n  'userid' => NULL,\n  'pathnamehash' => '74c104d54c05b5f8c633a36da516d37e6c5279e4',\n)]\nError code: dmlwriteexception\n* line 477 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* line 898 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* line 954 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()\n* line 1044 of /lib/filestorage/file_storage.php: call to pgsql_native_moodle_database->insert_record()\n* line 1468 of /lib/filestorage/file_storage.php: call to file_storage->create_directory()\n* line 499 of /lib/filestorage/file_storage.php: call to file_storage->create_file_from_string()\n* line 303 of /lib/filestorage/file_storage.php: call to file_storage->create_file_preview()\n* line 2238 of /lib/filelib.php: call to file_storage->get_file_preview()\n* line 88 of /draftfile.php: call to send_stored_file()\n, referer: http://localhost/sm/admin/settings.php?section=assignfeedback_editpdf
      

      This is my behat.yml file I was using:

      default:
        formatters:
          moodle_progress:
            output_styles:
              comment:
                - magenta
        suites:
          default:
            paths:
              - /home/fred/www/repositories/sm/moodle/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature
              - /home/fred/www/repositories/sm/moodle/availability/condition/grade/tests/behat/availability_grade.feature
              - /home/fred/www/repositories/sm/moodle/grade/report/singleview/tests/behat/bulk_insert_grades.feature
              - /home/fred/www/repositories/sm/moodle/grade/report/singleview/tests/behat/bulk_insert_grades.feature
              - /home/fred/www/repositories/sm/moodle/grade/grading/form/guide/tests/behat/edit_guide.feature
              - /home/fred/www/repositories/sm/moodle/grade/grading/form/rubric/tests/behat/edit_rubric.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/allow_another_attempt.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/comment_inline.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/display_error_message_onbadformat.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/display_error_message_onbadformat.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/display_grade.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/display_grade.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/edit_previous_feedback.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/filter_by_marker.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/grading_status.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/grading_status.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/outcome_grading.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/outcome_grading.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/quickgrading.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/quickgrading.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/rescale_grades.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/steps_blind_marking.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/submission_comments.feature
              - /home/fred/www/repositories/sm/moodle/mod/assign/tests/behat/submission_comments.feature
              - /home/fred/www/repositories/sm/moodle/completion/tests/behat/restrict_activity_by_grade.feature
              - /home/fred/www/repositories/sm/moodle/completion/tests/behat/restrict_section_availability.feature
              - /home/fred/www/repositories/sm/moodle/lib/form/tests/behat/modgrade_validation.feature
              - /home/fred/www/repositories/sm/moodle/lib/form/tests/behat/modgrade_validation.feature
              - /home/fred/www/repositories/sm/moodle/grade/tests/behat/grade_scales.feature
              - /home/fred/www/repositories/sm/moodle/grade/tests/behat/grade_single_item_scales.feature
            contexts:
              - behat_assignfeedback_editpdf
              - behat_block_comments
              - behat_editor_atto
              - behat_gradereport_grader
              - behat_gradingform_guide
              - behat_gradingform_rubric
              - behat_mod_choice
              - behat_mod_data
              - behat_mod_feedback
              - behat_mod_forum
              - behat_mod_glossary
              - behat_mod_quiz
              - behat_mod_workshop
              - behat_qtype_ddimageortext
              - behat_qtype_ddmarker
              - behat_qtype_ddwtos
              - behat_qtype_gapselect
              - behat_repository_upload
              - behat_tool_langimport
              - behat_tool_lp
              - behat_tool_lp_data_generators
              - behat_workshopallocation_manual
              - behat_admin
              - behat_auth
              - behat_blocks
              - behat_calendar
              - behat_cohort
              - behat_completion
              - behat_course
              - behat_enrol
              - behat_grade
              - behat_grading
              - behat_groups
              - behat_message
              - behat_question
              - behat_question_base
              - behat_filepicker
              - behat_backup
              - behat_transformations
              - behat_navigation
              - behat_permissions
              - behat_general
              - behat_data_generators
              - behat_forms
              - behat_deprecated
              - behat_hooks
        extensions:
          Behat\MinkExtension:
            base_url: 'http://localhost/sm'
            goutte: null
            selenium2:
              wd_host: 'http://localhost:4444/wd/hub'
              browser: chrome
          Moodle\BehatExtension:
            moodledirroot: /home/fred/www/repositories/sm/moodle
            steps_definitions:
              behat_assignfeedback_editpdf: /home/fred/www/repositories/sm/moodle/mod/assign/feedback/editpdf/tests/behat/behat_assignfeedback_editpdf.php
              behat_block_comments: /home/fred/www/repositories/sm/moodle/blocks/comments/tests/behat/behat_block_comments.php
              behat_editor_atto: /home/fred/www/repositories/sm/moodle/lib/editor/atto/tests/behat/behat_editor_atto.php
              behat_gradereport_grader: /home/fred/www/repositories/sm/moodle/grade/report/grader/tests/behat/behat_gradereport_grader.php
              behat_gradingform_guide: /home/fred/www/repositories/sm/moodle/grade/grading/form/guide/tests/behat/behat_gradingform_guide.php
              behat_gradingform_rubric: /home/fred/www/repositories/sm/moodle/grade/grading/form/rubric/tests/behat/behat_gradingform_rubric.php
              behat_mod_choice: /home/fred/www/repositories/sm/moodle/mod/choice/tests/behat/behat_mod_choice.php
              behat_mod_data: /home/fred/www/repositories/sm/moodle/mod/data/tests/behat/behat_mod_data.php
              behat_mod_feedback: /home/fred/www/repositories/sm/moodle/mod/feedback/tests/behat/behat_mod_feedback.php
              behat_mod_forum: /home/fred/www/repositories/sm/moodle/mod/forum/tests/behat/behat_mod_forum.php
              behat_mod_glossary: /home/fred/www/repositories/sm/moodle/mod/glossary/tests/behat/behat_mod_glossary.php
              behat_mod_quiz: /home/fred/www/repositories/sm/moodle/mod/quiz/tests/behat/behat_mod_quiz.php
              behat_mod_workshop: /home/fred/www/repositories/sm/moodle/mod/workshop/tests/behat/behat_mod_workshop.php
              behat_qtype_ddimageortext: /home/fred/www/repositories/sm/moodle/question/type/ddimageortext/tests/behat/behat_qtype_ddimageortext.php
              behat_qtype_ddmarker: /home/fred/www/repositories/sm/moodle/question/type/ddmarker/tests/behat/behat_qtype_ddmarker.php
              behat_qtype_ddwtos: /home/fred/www/repositories/sm/moodle/question/type/ddwtos/tests/behat/behat_qtype_ddwtos.php
              behat_qtype_gapselect: /home/fred/www/repositories/sm/moodle/question/type/gapselect/tests/behat/behat_qtype_gapselect.php
              behat_repository_upload: /home/fred/www/repositories/sm/moodle/repository/upload/tests/behat/behat_repository_upload.php
              behat_tool_langimport: /home/fred/www/repositories/sm/moodle/admin/tool/langimport/tests/behat/behat_tool_langimport.php
              behat_tool_lp: /home/fred/www/repositories/sm/moodle/admin/tool/lp/tests/behat/behat_tool_lp.php
              behat_tool_lp_data_generators: /home/fred/www/repositories/sm/moodle/admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php
              behat_workshopallocation_manual: /home/fred/www/repositories/sm/moodle/mod/workshop/allocation/manual/tests/behat/behat_workshopallocation_manual.php
              behat_admin: /home/fred/www/repositories/sm/moodle/admin/tests/behat/behat_admin.php
              behat_auth: /home/fred/www/repositories/sm/moodle/auth/tests/behat/behat_auth.php
              behat_blocks: /home/fred/www/repositories/sm/moodle/blocks/tests/behat/behat_blocks.php
              behat_calendar: /home/fred/www/repositories/sm/moodle/calendar/tests/behat/behat_calendar.php
              behat_cohort: /home/fred/www/repositories/sm/moodle/cohort/tests/behat/behat_cohort.php
              behat_completion: /home/fred/www/repositories/sm/moodle/completion/tests/behat/behat_completion.php
              behat_course: /home/fred/www/repositories/sm/moodle/course/tests/behat/behat_course.php
              behat_enrol: /home/fred/www/repositories/sm/moodle/enrol/tests/behat/behat_enrol.php
              behat_grade: /home/fred/www/repositories/sm/moodle/grade/tests/behat/behat_grade.php
              behat_grading: /home/fred/www/repositories/sm/moodle/grade/grading/tests/behat/behat_grading.php
              behat_groups: /home/fred/www/repositories/sm/moodle/group/tests/behat/behat_groups.php
              behat_message: /home/fred/www/repositories/sm/moodle/message/tests/behat/behat_message.php
              behat_question: /home/fred/www/repositories/sm/moodle/question/tests/behat/behat_question.php
              behat_question_base: /home/fred/www/repositories/sm/moodle/question/tests/behat/behat_question_base.php
              behat_filepicker: /home/fred/www/repositories/sm/moodle/repository/tests/behat/behat_filepicker.php
              behat_backup: /home/fred/www/repositories/sm/moodle/backup/util/ui/tests/behat/behat_backup.php
              behat_transformations: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_transformations.php
              behat_navigation: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_navigation.php
              behat_permissions: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_permissions.php
              behat_general: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_general.php
              behat_data_generators: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_data_generators.php
              behat_forms: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_forms.php
              behat_deprecated: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_deprecated.php
              behat_hooks: /home/fred/www/repositories/sm/moodle/lib/tests/behat/behat_hooks.php
      

      And I was testing as of b726542 (from MDL-54034) which is just ahead of fc1ef59 (3.1-beta).

      That looks like it could be a race condition due to multiple ajax calls running at the same time.

            Unassigned Unassigned
            fred Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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