Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2231199

Summary: Another deadlock issue when syncing repos with high concurrency
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Alexey Masolov <amasolov>
Component: PulpAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED ERRATA QA Contact: Radek Bíba <rbiba>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.5.0CC: mminar
Target Milestone: 4.6.0Keywords: Triaged
Target Release: 4.x   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-01 06:39:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexey Masolov 2023-08-11 02:03:02 UTC
This bug was initially created as a copy of Bug #2062526

I am copying this bug because: 
RHUI 4.5.0 doesn't contain the updated version of python39-pulpcore (the fixed one is 3.21.6-1.el8pc.noarch.rpm but we still have 3.21.0-1.0.1.el8ui.noarch in 4.5.0)


Description of problem:

rhui-manager
rhui (home) => s
rhui (sync) => vr

    7 - Error      Red Hat Enterprise Linux 6 Server - Extended Life Cycle Support (RPMs) from RHUI (x86_64)
      deadlock detected
DETAIL:  Process 158239 waits for ShareLock on transaction 26190837; blocked by process 158203.
Process 158203 waits for ShareLock on transaction 26191981; blocked by process 158239.
HINT:  See server log for query details.
CONTEXT:  while locking tuple (3768,56) in relation "core_contentartifact"

 Traceback:        File "/usr/lib/python3.9/site-packages/pulpcore/tasking/pulpcore_worker.py", line 452, in _perform_task
    result = func(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pulp_rpm/app/tasks/synchronizing.py", line 559, in synchronize
    repo_version = dv.create() or repo.latest_version()
  File "/usr/lib/python3.9/site-packages/pulpcore/plugin/stages/declarative_version.py", line 161, in create
    loop.run_until_complete(pipeline)
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
    await asyncio.gather(*futures)
  File "/usr/lib/python3.9/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
    await self.run()
  File "/usr/lib/python3.9/site-packages/pulpcore/plugin/stages/content_stages.py", line 197, in run
    await sync_to_async(process_batch)()
  File "/usr/lib/python3.9/site-packages/asgiref/sync.py", line 435, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
  File "/usr/lib64/python3.9/asyncio/tasks.py", line 442, in wait_for
    return await fut
  File "/usr/lib64/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.9/site-packages/asgiref/sync.py", line 476, in thread_handler
    return func(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pulpcore/plugin/stages/content_stages.py", line 186, in process_batch
    len(subq.values_list())
  File "/usr/lib/python3.9/site-packages/django/db/models/query.py", line 262, in __len__
    self._fetch_all()
  File "/usr/lib/python3.9/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/lib/python3.9/site-packages/django/db/models/query.py", line 140, in __iter__
    return compiler.results_iter(tuple_expected=True, chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1130, in results_iter
    results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
  File "/usr/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

Comment 5 errata-xmlrpc 2023-11-01 06:39:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (RHUI 4.6.0 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6225