Bug #39226
Updated by Pablo Méndez Hernández 4 months ago
A recent refactor Commit 1d8b067 (Fixes #38930) replaced `create_or_find_by` with `create` in RhsmFactParser#operatingsystem, re-introducing a the race condition that had previously been fixed. originally fixed by #38169 (jlenz). Under concurrent bulk registration, 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 (Shim's multi-constraint lookup introduced by the same refactor) from #38930) as the last-resort fallback — combining the best of both fixes.