Note that there are some explanatory texts on larger screens.

plurals
  1. POGunicorn + Subprocesses raises exception [Errno 10]
    primarykey
    data
    text
    <p>I've stumbled across a weird exception I haven't been able to resolve... can anyone suggest what is wrong or a new design? I'm running a Gunicorn/Flask application. In the configuration file, I specify some work to do with an <code>on_starting</code> hook [1]. Inside that hook code, I have some code like this (nothing fancy):</p> <pre><code># Called before the server is started my_thread = package.MyThread() my_thread.start() </code></pre> <p>The package.MyThread class looks like the following. The <code>ls</code> command is unimportant, it can be any command.</p> <pre><code>class MyThread(threading.Thread): """ Run a command every 60 seconds. """ def __init__(self): threading.Thread.__init__(self) self.event = threading.Event() def run(self): while not self.event.is_set(): ptest = subprocess.Popen(["ls"], stdout=subprocess.PIPE) ptest.communicate() self.event.wait(60) def stop(self): self.event.set() </code></pre> <p>Upon starting up the server, I'm always presented with this exception:</p> <pre><code>Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "__init__.py", line 195, in run ptest.communicate() File "/usr/lib64/python2.6/subprocess.py", line 721, in communicate self.wait() File "/usr/lib64/python2.6/subprocess.py", line 1288, in wait pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0) File "/usr/lib64/python2.6/subprocess.py", line 462, in _eintr_retry_call return func(*args) OSError: [Errno 10] No child processes </code></pre> <p>Can anyone suggest what is going on here? I haven't tried implementing the changes in [2], they seemed hacky.</p> <p>[1] - <a href="http://gunicorn.org/configure.html#server-hooks" rel="nofollow noreferrer">http://gunicorn.org/configure.html#server-hooks</a></p> <p>[2] - <a href="https://stackoverflow.com/questions/1008858/popen-communicate-throws-oserror-errno-10-no-child-processes">Popen.communicate() throws OSError: &quot;[Errno 10] No child processes&quot;</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload