[openstack-dev] Dealing with Popen and Eventlet

Vishvananda Ishaya vishvananda at gmail.com
Wed Nov 7 07:52:28 UTC 2012


On Nov 2, 2012, at 6:40 PM, Adam Young <ayoung at redhat.com> wrote:

> 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.

Why not just do the standard

try:
  from eventlet.green import subprocess
except ImportError:
  import subprocess

We've used that in various places in nova before.

Vish




More information about the OpenStack-dev mailing list