Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-27512 Container push sometimes makes duplicate repos due to race condition
  3. SAT-27513

[DEV] Container push sometimes makes duplicate repos due to race condition

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • Repositories
    • Sprint 138, Sprint 139

      Description of problem:

      Seemingly randomly, sometimes a container push results in two repositories being created, which fails the push with the "Its Container Repository Name (%{container_name}) conflicts with an existing repository." error.

       

      This is due to a race condition. Since APIs are called simultaneously, I was able to catch two puma workers both reaching https://github.com/katello/katello/blob/master/app/controllers/katello/api/registry/registry_proxies_controller.rb#L346 at the same time.

      The get_root_repo_from_product check returns true for both workers, so two repositories get created. We need to figure out how to synchronize the simultaneous requests.

       

      How reproducible:

      Sometimes, it's a race condition.

      Is this issue a regression from an earlier version:

      No.

      Steps to Reproduce:

      1. Stick a debugger before the `get_root_repo_from_product` line in `create_container_repo_if_needed`.

      2. Push Quay's prometheus/busybox image

      3. In the debugger, see that two separate workers both reach the same line of code. This is an indication that there's a race condition – it's possible that the repository will not be created yet for either.

      Actual behavior:

      An error about the container repo name conflicting is thrown.

      Expected behavior:
      The container image is pushed without error.

      Business Impact / Additional info:

       

      DEV Tracker for https://issues.redhat.com/browse/SAT-27512

            rhn-engineering-sajha Samir Jha
            satellite-jira-automation@redhat.com Satellite Jira-Automation
            Quinn James Quinn James
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: