Project

General

Profile

Actions

action #153616

closed

Prevent `duplicate key value violates unique constraint` on image uploads size:S

Added by mkittler 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2024-01-16
Due date:
% Done:

0%

Estimated time:

Description

Observation

Jan 15 11:15:43 susetest openqa-webui-daemon[2989]: [error] Unexpected error when updating job 1 executed by worker susetest:1: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR:  duplicate key value violates unique constraint "needles_dir_id_filename"
Jan 15 11:15:43 susetest openqa-webui-daemon[2989]: DETAIL:  Key (dir_id, filename)=(1, root-console-20180724.json) already exists. [for Statement "INSERT INTO needles ( dir_id, file_present, filename, last_matched_module_id, last_matched_time, last_seen_module_id, last_seen_time, t_created, t_updated) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? ) RETURNING id" with ParamValues: 1='1', 2='1', 3='root-console-20180724.json', 4='6', 5='2024-01-15 16:15:43', 6='6', 7='2024-01-15 16:15:43', 8='2024-01-15 16:15:43', 9='2024-01-15 16:15:43'] at /usr/share/openqa/script/../lib/OpenQA/Schema/Result/Needles.pm line 79

That happen sometimes in tests scheduled during development of #138302, see also https://github.com/os-autoinst/os-autoinst-distri-openQA/pull/159#issuecomment-1893367879. It possibly leads to tests terminating prematurely without logs being uploaded (because no retry is happening and the problem is considered fatal immediately; due to the missing logs this is yet to be confirmed, though).

Acceptance criteria

  • AC1: Two jobs uploading the same needle concurrently never run into the error mentioned above

Suggestions

  • Remove race condition from code pointed out by the error message as well as the creation of the dir lib/OpenQA/Schema/Result/Needles.pm:79
  • Test this code against the scenario from #138302: for i in {01..10} ; do openqa-clone-job --within-instance https://openqa.opensuse.org/tests/3871539 --skip-chained-deps --skip-download TEST=dheidler_mm2_ping_$i BUILD=dheidler_mm2_ping _GROUP=0 PUBLISH_HDD_1= PUBLISH_PFLASH_VARS= ; done

Related issues 1 (0 open1 closed)

Blocks openQA Project - action #138302: Ensure automated openQA tests verify that os-autoinst-setup-multi-machine sets up valid networking size:MResolveddheidler2023-07-192024-01-19

Actions
Actions #1

Updated by dheidler 3 months ago

  • Blocks action #138302: Ensure automated openQA tests verify that os-autoinst-setup-multi-machine sets up valid networking size:M added
Actions #2

Updated by mkittler 3 months ago

  • Subject changed from Prevent `duplicate key value violates unique constraint` on image uploads to Prevent `duplicate key value violates unique constraint` on image uploads size:S
  • Description updated (diff)
  • Status changed from New to In Progress
  • Target version set to Ready
Actions #3

Updated by mkittler 3 months ago

  • Status changed from In Progress to Feedback
Actions #4

Updated by mkittler 3 months ago

  • Status changed from Feedback to Resolved

The issue is no longer reproducible in the 100 testruns on https://openqa.opensuse.org/tests/overview?version=Tumbleweed&build=dheidler_mm3_ping&distri=openqa&groupid=38 (which in turn spawned 200 nested test runs). (There are two failing tests but those are different issues.) So I'm closing this issue.

Actions

Also available in: Atom PDF