Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-18656

Can't delete host right after facts gathered - foreign key violation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 6.14.0
    • Fact
    • Moderate
    • None

      Description of problem:
      Sometimes, when I try to delete a host right after I played its ansible roles and facts import got triggered in background, I get ISE and a foreign key violation. Looks like race condition when host deleting starts and before it is finished, its facts are imported and deletion fails.

      Version-Release number of selected component (if applicable):
      Reproduced on Sat 6.15 stream snap 18.0, I don't have a reason to think it's a regression but I haven't tested.

      How reproducible:
      Random. I was able to reproduce in automation using API when the client was RHEL8, perhaps because it has more facts than RHEL7. Adding a few seconds sleep between play-roles and host delete proved as workaround.

      Steps to Reproduce:
      Run facts on a RHEL8 host and delete it immediately.

      Actual results:
      ISE 500:
      Backtrace for 'Action failed' error (ActiveRecord::InvalidForeignKey): PG::ForeignKeyViolation: ERROR: update or delete on table "hosts" violates foreign key constraint "fact_values_host_id_fk" on table "fact_values"

      Expected results:
      Host removed, or at least delete failed gracefully

      Additional info:
      production.log including traceback attached

            jira-bugzilla-migration RH Bugzilla Integration
            lhellebr@redhat.com Lukas Hellebrandt
            Shweta Singh Shweta Singh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: