[openstack-dev] Is shade (and os_client_config) thread safe?

David Shrewsbury shrewsbury.dave at gmail.com
Tue Aug 8 13:14:35 UTC 2017


This looks more like an os_client_config problem. That key should always be
defined as it is set in the defaults. However, now that I look at the
default handling code, I see it uses a global variable (in defaults.py),
which probably isn't going to play well in a threaded environment. I highly
suspect this portion of code needs fixing.

-Dave

On Mon, Aug 7, 2017 at 4:52 PM, Joshua Harlow <harlowja at fastmail.com> wrote:

> Hi there folks,
>
> I'm doing various scans of our clouds here at godaddy and using shade to
> do some of the calls.
>
> Though when I do stuff like the following sometimes it has issues...
>
> http://paste.openstack.org/show/617712/
>
> Typically this causes the following error:
>
> Traceback (most recent call last):
>   File "tools/fetch_flavors.py", line 72, in <module>
>     main()
>   File "tools/fetch_flavors.py", line 61, in main
>     results.append(fut.result())
>   File "/Users/jxharlow/.venv/lib/python2.7/site-packages/concurrent/futures/_base.py",
> line 422, in result
>     return self.__get_result()
>   File "/Users/jxharlow/.venv/lib/python2.7/site-packages/concurrent/futures/thread.py",
> line 62, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "tools/fetch_flavors.py", line 24, in extract_cloud
>     client = shade.openstack_cloud(cloud=cloud_name)
>   File "/Users/jxharlow/.venv/lib/python2.7/site-packages/shade/__init__.py",
> line 106, in openstack_cloud
>     return OpenStackCloud(cloud_config=cloud_config, strict=strict)
>   File "/Users/jxharlow/.venv/lib/python2.7/site-packages/shade/openstackcloud.py",
> line 156, in __init__
>     self.image_api_use_tasks = cloud_config.config['image_api_use_tasks']
> KeyError: 'image_api_use_tasks'
>
> Though if I add a lock around the following then things go better:
>
> with SHADE_LOCK:
>     client = shade.openstack_cloud(cloud=cloud_name)
>
> So that makes me wonder, is ummm, this library (or one of its dependencies
> not thread-safe?); has anyone else seen similar things, perhaps they've
> already been fixed?
>
> -Josh
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
David Shrewsbury (Shrews)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170808/7cac62fd/attachment.html>


More information about the OpenStack-dev mailing list