Bug 2038742

Summary: pulp3 content migration failed with "Katello::Errors::Pulp3Error: local variable 'item' referenced before assignment"
Product: Red Hat Satellite Reporter: matt jia <mjia>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: high    
Version: 6.9.8CC: dkliban, ggainey, hakon.gislason, janarula, jjansky, momran, osousa, pcurie, pmendezh, saydas
Target Milestone: 6.9.9Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulp-2to3-migration-0.11.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-20 20:34:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description matt jia 2022-01-10 00:12:15 UTC
Description of problem:

As $summary, migration docker repos failed with:

  error:
    traceback: |2
        File "/usr/lib/python3.6/site-packages/rq/worker.py", line 936, in perform_job
          rv = job.perform()
        File "/usr/lib/python3.6/site-packages/rq/job.py", line 684, in perform
          self._result = self._execute()
        File "/usr/lib/python3.6/site-packages/rq/job.py", line 690, in _execute
          return self.func(*self.args, **self.kwargs)
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py", line 81, in migrate_from_pulp2
          migrate_content(plan, skip_corrupted=skip_corrupted)
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 55, in migrate_content
          plugin.migrator.migrate_content_to_pulp3(skip_corrupted=skip_corrupted)
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/docker/migrator.py", line 106, in migrate_content_to_pulp3
          loop.run_until_complete(dm.create())
        File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
          return future.result()
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 89, in create
          await pipeline
        File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
          await asyncio.gather(*futures)
        File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
          await self.run()
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/docker/migrator.py", line 154, in run
          thru = self.relate_manifest_to_list(dc)
        File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/docker/migrator.py", line 234, in relate_manifest_to_list
          thru = ManifestListManifest(manifest_list=item, image_manifest=dc.content,
    description: local variable 'item' referenced before assignment
 

Version-Release number of selected component (if applicable):

6.9

How reproducible:

on customer site

Steps to Reproduce:

1.  satellite-maintain content prepare

Actual results:

Migration failed with above error.


Expected results:

Migration should complete without error.

Additional info:

Comment 1 Sayan Das 2022-01-28 14:13:44 UTC
A) This seems to have been or are being addressed in upstream

migration docker repos failed with "local variable 'item' referenced before assignment" · Issue #497 · pulp/pulp-2to3-migration · GitHub
https://github.com/pulp/pulp-2to3-migration/issues/497

Fixes #497 - local variable 'item' referenced before assignment · pulp/pulp-2to3-migration@72a6325 · GitHub
https://github.com/pulp/pulp-2to3-migration/commit/72a632553cf131b5aa20f40aefb2eefdee2cff21



B) every time this traceback has come, just before that pulp complained about missing or corrupted blobs. Further investigation of those blobs revealed, That they are part of the same repo and they are indeed missing from filesystem.

   I also had dig into docker manifests and found many of them corrupted as well. Not sure if they are related to the same blobs or not but there is a good possibility they are. Further information will be added in the later comments.

Comment 6 Grant Gainey 2022-02-17 13:42:54 UTC
Fix backported to pulp-2to3-migration 0.11.9

Comment 7 Lai 2022-03-23 21:58:24 UTC
Hey guys,

Is there a sample docker repo I can use to test this migration or is any docker fine?

Comment 8 Sayan Das 2022-03-23 22:09:22 UTC
Hello Lai,

I doubt if I know of a sample repo but maybe Matt ( reporter ) does.

Can you check with him once if he were able to reproduce this issue via any specific repo  initially ?


-- Sayan

Comment 9 Lai 2022-03-24 19:10:00 UTC
Hey Matt,

Was there a specific repo that was used for this bz?  I would like to use it for verification if there is one.

-Lai

Comment 13 Lai 2022-04-12 15:00:41 UTC
Steps to retest:

1. Sync some docker files: small, medium, and large docker files
2. Perform migration
3. check results

2nd set of test:
1. sync some docker files: small, medium, and large docker files
2. delete some docker blobs in /var/lib/pulp/content/units/ <either docker_manifest or docker_blob>
3. perform migration


Expected results:
Migration should complete successfully

Actual:
Migration does complete successfully

I also checked the dynflow and the results on UI.  It seems to work fine.

Verified on 6.9.9 snap 2

Comment 17 errata-xmlrpc 2022-04-20 20:34:53 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 (Important: Satellite 6.9.9 Async Bug Fix 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/RHSA-2022:1478