-
Notifications
You must be signed in to change notification settings - Fork 59
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
AttributeError
when __del__ is called on S3Client that errors during __init__
#372
Comments
To be clear, this is not a blocker for anything, just a small nit that seems pretty easy to clean up 😄 |
Just took a quick skim, and it seems like that to me as well. Thanks for diagnosing, and PR is welcome! |
This one seems to be back in 0.18.1:
|
From a quick look here, it looks like we fixed it in #373 for the |
In this case, and because the issue appears only rarely on our side, I would assume it happens in a multithreading scenario. We basically upload files in parallel with workers, but only a fraction of the workers actually upload a file. The simplified code: from multiprocessing.pool import ThreadPool
from cloudpathlib import S3Path
def do(i):
dst = S3Path('s3://somewhere') / f'hello_{i}.txt'
dst.write_bytes(b'hello')
ThreadPool(processes=20).map(do, range(100)) |
@bryanwweber @sbrandtb This is realeased now in v0.19.0 if you want to upgrade and test your use case. |
@pjbull Thanks for fixing and the personal notification ❤️ Honestly, we wrapped the deployment code where it happened in retry and called it a day. Our logs show that the issue happened still 5 times in August, but zero times since the release of the patch. Thanks again! |
If an exception is raised during the creation of an S3Client instance, subsequently tearing down that instance via
Client.__del__
results n anAttributeError
:This is happening because the
super().__init__()
call happens at the bottom of theS3Client.__init__()
method (here), soClient.file_cache_mode
is not set before the error occurs. I checked and there doesn't seem to be a particular reason thatsuper().__init__()
needs to be called at the bottom (all the args are just pass through from theS3Client.__init__()
signature). I'm happy to submit a PR to fix this by moving thesuper().__init__()
up inS3Client.__init__()
and other related classes too, if that seems like the right fix. Thanks!The text was updated successfully, but these errors were encountered: