Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch forbidden errors as notfound #33148

Closed
wants to merge 2 commits into from
Closed

Conversation

damccorm
Copy link
Contributor

When getting a bucket, if the bucket does not exist it can manifest as forbidden as well (basically, the error is "I don't know if this bucket exists or not"). In those cases, we should probably treat the bucket as not found. This is currently causing some precommit failures, for example https://github.com/apache/beam/actions/runs/11888837746/job/33124186007

Fixes #31285
Fixes #30813


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@damccorm
Copy link
Contributor Author

R: @shunping

Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@@ -172,7 +173,7 @@ def get_bucket(self, bucket_name, **kwargs):
try:
return self.client.lookup_bucket(
bucket_name, retry=self._storage_client_retry, **kwargs)
except NotFound:
except (Forbidden, NotFound):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method that is failing exists() [1], which calls _gcs_object().

The Forbidden error mentions it can be a permission issue or the bucket does not exist. So we might swallow actual permission issues too.

I think we can list the buckets with a prefix to check for existence explicitly.

client.list_buckets(prefix=bucket_name)

[1]

def exists(self, path):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right about it being exists, I added it there as well.

The Forbidden error mentions it can be a permission issue or the bucket does not exist. So we might swallow actual permission issues too.

I think this is going to be true even if we do what you're suggesting. If there are permissions issues, the bucket won't show up in our list call either

@damccorm
Copy link
Contributor Author

Closing in favor of #33151

@damccorm damccorm closed this Nov 18, 2024
@damccorm damccorm deleted the users/damccorm/notfound branch November 18, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The PreCommit Python ML tests with ML deps installed job is flaky The PreCommit Python Coverage job is flaky
2 participants