[openstack-dev] Dealing with Popen and Eventlet

Adam Young ayoung at redhat.com
Wed Nov 7 18:22:19 UTC 2012


On 11/05/2012 02:29 PM, Joshua Harlow wrote:
> Hmmm, it seems like unless u start adjusting all the nova-api and such to
> use apache (which isn't clearly documented, afaik) then the default web
> server is the built-in eventlet web server. Perhaps the community in
> general should do what sandy recommends, and say the default that u get is
> really only for small use-cases, and you should really be using a real
> webserver (or make the default non-service case use apache...)
I think this is the right approach.  Apache HTTPD maps better to our 
usage than Eventlet.


>
> -Josh
>
> On 11/2/12 6:57 PM, "Sandy Walsh" <sandy.walsh at RACKSPACE.COM> wrote:
>
>> Interesting question, and sorry for my nativity, but do we use eventlet
>> in a web server? I thought we leaned on the web server to deal with the
>> threading and only used eventlet in the services?
>>
>> Or am I missing something?
>>
>> -S
>>   
>> ________________________________________
>> From: Adam Young [ayoung at redhat.com]
>> Sent: Friday, November 02, 2012 10:40 PM
>> To: OpenStack Development Mailing List
>> Subject: [openstack-dev] Dealing with Popen and Eventlet
>>
>> Since Eventlet is based on continuations instead of threads or
>> processes, any call that blocks is going to lock up the webserver. That
>> is any I/O at all.  Thus, when trying to figure out how best to call the
>> OpenSSL functions from Eventlet, I settled on what I thought would be
>> the best tested approach: spin it off as a separate process.  And it
>> seemed to work.
>>
>> Well, it doesn't work.  The Eventlet library does not properly Monkey
>> patch the subprocess calls from Python.  While this is something we
>> should patch upstream in Eventlet,  we need something to deal with the
>> existing Eventlet library for Grizzly development.
>>
>> I've been trying to make it possible to run Keystone (and the other
>> services eventually) in Apache.  Thus, the simple solution of replacing
>>
>> import subprocess
>>
>> with
>>
>> import eventlet.green.subprocess
>>
>> Won't work.  It solves the problem in Eventlet, but not apache.
>>
>> It is possible to do something like this code below:
>>
>> in the file keystone/common/interop/__init__.py
>>
>> import sys
>> if 'eventlet' in sys.modules:
>>      import eventlet.green.subprocess as interop_subprocess
>>      print sys.modules["eventlet"]
>> else:
>>      import subprocess as interop_subprocess
>>
>> PIPE = interop_subprocess.PIPE
>> CalledProcessError = interop_subprocess.CalledProcessError
>> Popen = interop_subprocess.Popen
>> #end interop
>>
>>
>> and then, instead of
>> import eventlet.green.subprocess
>>
>> we can import keystone.common.interop as subprocess
>>
>> The problem is that the if statement is not triggered when this import
>> is hit, as the eventlet code has not yet been imported elsewhere.
>>
>> What is the right way of detecting what web server we are running in and
>> selecting which version of the subprocess code to import?
>>
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> _______________________________________________
> 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