Project

General

Profile

Actions

Bug #39226

closed

Fix RHSM OS race condition reintroduced by recent refactor

Added by Pablo Méndez Hernández 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Fixed in Releases:
Found in Releases:

Description

A recent refactor replaced `create_or_find_by` with `create` in RhsmFactParser#operatingsystem, re-introducing a race condition that had previously been fixed. Under concurrent bulk registration, multiple hosts try to create the same OS record simultaneously, causing PG::UniqueViolation on index_operatingsystems_on_title.

Fix: restore `create_or_find_by` (atomic insert with conflict fallback) and use `find_by_attributes` (the multi-constraint lookup introduced by the same refactor) as the last-resort fallback — combining the best of both fixes.

Actions

Also available in: Atom PDF