-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Google Cloud Storage failing when using threads #3501
Comments
@Alexis-Jacob That's correct, the error you are seeing is caused by the lack of thread-safety in |
@Alexis-Jacob I am going to pre-emptively close this issue because it is "known" and something we are working on. If you'd like a thread-safe transport, I recommend looking into https://github.com/GoogleCloudPlatform/httplib2shim @jonparrott Is there a "better" recommendation to make? |
Not for the time being.
|
Wow, can we get this added to the top level Additionally,
|
Thanks for the instant response! I get that this is going to be fixed "soon", but this was a bit of a surprise for me to discover that this is a known issue for the current release that only seems to be documented in Github Issues. I would love it if the following page would say "Client is not thread-safe; do not use it between threads": https://googlecloudplatform.github.io/google-cloud-python/stable/storage-client.html Once the bug is fixed, then the docs could be fixed :) Also don't worry about the exception, I'm probably doing something weird or have some library version mismatch. I'm just going to fix my code to not re-use clients, since that seems like the more sane, documented solution at the moment. |
Indeed, thanks for the patience @evanj. |
I would like to add (for googling purposes) that I got the following errors inconsistently:
Passing a new client to each new process solved this. |
Are you using |
@tseaver Both. I think it's best if I quickly also describe what I was doing. So as a workaround I fetch all blobs I want to download with When only multithreading I got no errors passing a single Client/Bucket ( |
@RomHartmann I'm not too surprised that the |
you need to create a new client connection for every pool / thread inside def upload(bucket, i). from multiprocessing.pool import ThreadPool def upload(i): pool = ThreadPool() |
The text was updated successfully, but these errors were encountered: