Project

Profile

Help

Issue #8787

closed

"UnboundLocalError: local variable 'result' referenced before assignment" on attempt to sync some repos

Added by sskracic@redhat.com almost 3 years ago. Updated almost 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 100
Quarter:

Description

Today I was trying to sync some Red Hat repos with fresh pulp-rpm 3.12.0 release. Everything went well, except for couple of repos that generated this stack trace in the logs:

May 20 11:20:17 pulp3.skracic.net rq[1495551]: pulp [612c4427c121435c9fea0b933098c1cd]: pulp_rpm.app.tasks.synchronizing:INFO: Synchronizing: repository=rhel-8
-for-aarch64-appstream-beta-source-rhui-rpms remote=rhel-8-for-aarch64-appstream-beta-source-rhui-rpms
May 20 11:20:17 pulp3.skracic.net rq[1495559]: pulp [9e8d4c3e69de43b58bb023182fe0db84]: rq.worker:ERROR: Traceback (most recent call last):
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 1013, in perform_job
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     rv = job.perform()
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 709, in perform
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     self._result = self._execute()
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 732, in _execute
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     result = self.func(*self.args, **self.kwargs)
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 227, in synchronize
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     remote_url = fetch_remote_url(remote)
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 141, in fetch_remote_url
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     if get_repomd_file(remote, remote_url):
May 20 11:20:17 pulp3.skracic.net rq[1495559]:   File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 110, in get_repomd_file
May 20 11:20:17 pulp3.skracic.net rq[1495559]:     return result
May 20 11:20:17 pulp3.skracic.net rq[1495559]: UnboundLocalError: local variable 'result' referenced before assignment

Upon further inspection, it looks like the repos themselves have been "turned off" following the RHEL 8.4 GA, and when tried to download using the command line utilities, 403 Forbidden error code is retrieved.

So it looks like the exception handling should deal with 403 returned from the remote URL.

My Pulp installation is running on RHEL 8, BTW.


Related issues

Related to Pulp - Story #8873: pulp 3 stops when encounters 403 errorCLOSED - DUPLICATE

Actions
Has duplicate RPM Support - Issue #9019: A variable referenced before assignment while reading repomd CLOSED - DUPLICATEActions
Has duplicate RPM Support - Issue #9022: errors fetching repomd.xml will fail with python error 'local variable 'result' referenced before assignment'CLOSED - DUPLICATEActions
Copied to RPM Support - Backport #9027: Backport 8787 to 3.13.3CLOSED - CURRENTRELEASEdalley

Actions
Actions #1

Updated by ttereshc almost 3 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 97
Actions #2

Updated by dalley almost 3 years ago

  • Status changed from NEW to POST
  • Assignee set to zhunting
Actions #4

Updated by dalley almost 3 years ago

  • Assignee changed from zhunting to dalley

whoops

Actions #5

Updated by rchan almost 3 years ago

  • Sprint changed from Sprint 97 to Sprint 98
Actions #6

Updated by dalley almost 3 years ago

  • Related to Story #8873: pulp 3 stops when encounters 403 error added
Actions #7

Updated by rchan almost 3 years ago

  • Sprint changed from Sprint 98 to Sprint 99
Actions #8

Updated by rchan almost 3 years ago

  • Sprint changed from Sprint 99 to Sprint 100
Actions #9

Updated by dalley almost 3 years ago

  • Related to Issue #9019: A variable referenced before assignment while reading repomd added
Actions #10

Updated by dalley almost 3 years ago

  • Related to deleted (Issue #9019: A variable referenced before assignment while reading repomd )
Actions #11

Updated by dalley almost 3 years ago

  • Has duplicate Issue #9019: A variable referenced before assignment while reading repomd added
Actions #12

Updated by dalley almost 3 years ago

  • Has duplicate Issue #9022: errors fetching repomd.xml will fail with python error 'local variable 'result' referenced before assignment' added

Added by dalley almost 3 years ago

Revision 727b530b | View on GitHub

Fix unbound local error when Pulp receives a non-404 ClientResponseError

If Pulp receives a ClientResponseError when attempting to download a file, but the status code isn't 404, then we go down the wrong code path.

closes: #8787 https://pulp.plan.io/issues/8787

Actions #13

Updated by dalley almost 3 years ago

  • Status changed from POST to MODIFIED
Actions #14

Updated by dalley almost 3 years ago

Actions #15

Updated by dalley almost 3 years ago

  • Sprint/Milestone set to 3.13.3
Actions #16

Updated by dalley almost 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF