← Back to team overview

openstack team mailing list archive

Re: eventlet weirdness

 

I have been encountering these quite a bit myself recently in another
project.

For me the errors were a result of tpool.execute() in a non-cooperative
thread context.  My guess as to the root cause is that some of eventlet's
cooperative waiting code is not safe to use when not running in an eventlet
coroutine context.  My solution (which may not work for you) involved
switching based on whether I'm in a greenthread or not, and either call
tpool.execute() or the underlying function directly.  Fortunately for me I
can know at compile time what context I will be in. I think there is a way
to query eventlet to see if you are currently in a greenthread or not, but
I haven't finished diving into that documentation yet.

Good luck,
Mark

On Wed, Feb 29, 2012 at 1:02 PM, Yun Mao <yunmao@xxxxxxxxx> wrote:

> Hi,
>
> we sometimes notice this error message which prevent us from starting
> nova services occasionally. We are using a somewhat modified diablo
> stable release on Ubuntu 11.10. It may very well be the problem from
> our patches but I'm wondering if you guys have any insight. In what
> condition does this error occur? There is a similar bug in here:
> https://bugs.launchpad.net/nova/+bug/831599
>
> but that doesn't offer much insight to me. Helps are very appreciated.
> Thanks,
>
> Yun
>
> 2012-02-23 16:54:52,788 DEBUG nova.utils
> [43f98259-6ba8-4e5d-bc0e-9eab978194e5 None None] backend <module
> 'nova.db.sqlalchemy.api' from
> '/opt/stack/nova/nova/db/sqlalchemy/api.pyc'> from (pid=6385)
> __get_backend /opt/stack/nova/nova/utils.py:449
> Traceback (most recent call last):
>  File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line
> 336, in fire_timers
>    timer()
>  File "/usr/lib/python2.7/dist-packages/eventlet/hubs/timer.py", line
> 56, in __call__
>    cb(*args, **kw)
>  File "/usr/lib/python2.7/dist-packages/eventlet/semaphore.py", line
> 95, in _do_acquire
>    waiter.switch()
> error: cannot switch to a different thread
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>

References