[openstack-dev] [all] [oslo] Proposed database connectivity patterns
Joshua Harlow
harlowja at outlook.com
Fri Oct 10 18:21:30 UTC 2014
On Oct 10, 2014, at 3:13 AM, Ihar Hrachyshka <ihrachys at redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> On 09/10/14 21:29, Mike Bayer wrote:
>> So so far, everyone seems really positive and psyched about the
>> proposal.
>>
>> It looks like providing some options for how to use would be best,
>> that is provide decorators and context managers.
>>
>> Now the thing with the context manager, it can be as I stated:
>>
>> with sql.reader() as session:
>>
>> or we can even have that accept the “context”:
>>
>> with sql.reader(context) as session:
>>
>> The latter again avoids having to use thread locals.
>>
>> But can I get a feel for how comfortable we are with using thread
>> local storage to implement this feature? I had anticipated people
>> wouldn’t like it because it’s kind of a “global” object, even
>> though it will be hidden behind this facade (of course CONF is
>> global as is sys.modules, and I think it is fine). If I just
>> use a tlocal, this whole thing is pretty simple.
>
> Won't the approach conflict with eventlet consumers that for some
> reason do not patch thread module, or do not patch it early enough? I
> guess in that case we may end up with mixed contexts.
Eck, this is not something people should be doing (not patching the thread module).
Example for why @ https://gist.github.com/harlowja/9c35e443dfa136a4f965 (run that and see your program lock up).
Once you accept/use eventlet, u shouldn't really be accepted half of it, otherwise there be dragons there; especially since openstack doesn't control what external library code does inside those libraries (and rightfully so it shouldn't), and if any library does anything like that gist code, the whole application will lock up...
>
> /Ihar
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
>
> iQEcBAEBCgAGBQJUN7FeAAoJEC5aWaUY1u57sq0IANSM8gKCQZbgEY62uvyhZqzN
> 9gRDcFbTrH/yUNMv0tt3+e2vVEbn8VIatDWG4/OYghzuI1BerKzhP7JD5J+mV8yK
> sB0fc6ybHmz14T962LhFkAxWKybPW3sJO/0GIy606ty0OEV8QAgPwaYvjW596MUa
> BAp0IRAz4/MglT/M80OkT2jFdMV+a9SAFUKvnF/21KSGo/t4qcawA/+B0c3Ownle
> eYt+Auk3hcgJnZAvCOwy7bcAb1b12gonk4nIwMl/Mik8IKNR5fnl1IqTiISUO2Jw
> PV95/7muukSrt54lY+9u4SW9o/Zf/gaNCMmK3xfDmvMug6tk0SWzkzBZLva3wNc=
> =04Wx
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
More information about the OpenStack-dev
mailing list