-
Notifications
You must be signed in to change notification settings - Fork 82
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
388 race condition occurs when adding folder to shared items in shares and errors out #392
388 race condition occurs when adding folder to shared items in shares and errors out #392
Conversation
@@ -196,7 +196,11 @@ def manage_access_point_and_policy(self): | |||
) | |||
access_point_arn = S3.create_bucket_access_point(self.source_account_id, self.source_environment.region, self.bucket_name, self.access_point_name) | |||
# Access point creation is slow | |||
time.sleep(5) | |||
while not S3.get_bucket_access_point_arn(self.source_account_id, self.source_environment.region, self.access_point_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We potentially can stuck here forever if there is an error and we can't create a access point. Should we think about task execution limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeep, I always overlook while loops! Thank you
logger.info( | ||
'Waiting 30s for access point creation to complete..' | ||
) | ||
time.sleep(30) | ||
existing_policy = S3.get_access_point_policy(self.source_account_id, self.source_environment.region, self.access_point_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to request information twice we could do:
access_point_arn = S3.create_bucket_access_point(self.source_account_id, self.source_environment.region, self.bucket_name, self.access_point_name)
existing_policy = None
num_retries = ...
while not existing_policy and num_retries > 0:
num_retries -= 1
waiting....
existing_policy = S3.get_access_point_policy....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The policy should not exist even after we create the access point. So checking the policy existence is not going to solve the issue. The error arises when we try to attach a new policy to a still-creating access point. But open to ideas on how to make it better, I coded it a bit fast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification!
Feature or Bugfix
Detail
Relates
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.