mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix pid
This commit is contained in:
parent
a10ca702e9
commit
85ec7b3ebc
@ -66,16 +66,12 @@ group = None # Change process group to group
|
||||
proc_name = None # Change the process name
|
||||
tmp_upload_dir = None # Set path used to store temporary uploads
|
||||
|
||||
def after_fork(server, worker):
|
||||
fmt = "worker=%s spawned pid=%s"
|
||||
server.log.info(fmt % (worker.id, worker.pid))
|
||||
after_fork=lambda server, worker: server.log.info(
|
||||
"Worker spawned (pid: %s)" % worker.pid),
|
||||
|
||||
def before_fork(server, worker):
|
||||
fmt = "worker=%s spawning"
|
||||
server.log.info(fmt % worker.id)
|
||||
before_fork=lambda server, worker: True,
|
||||
|
||||
def before_exec(server):
|
||||
serer.log.info("Forked child, reexecuting.")
|
||||
before_exec=lambda server: server.log.info("Forked child, reexecuting"
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="parameter-descriptions">
|
||||
|
||||
@ -127,7 +127,7 @@ exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP
|
||||
<a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/supervisor.conf">simple configuration</a> is:</p>
|
||||
<pre class="literal-block">
|
||||
[program:gunicorn]
|
||||
command=/usr/local/bin/gunicorn main:application -C /path/to/project/gunicorn.conf.py
|
||||
command=/usr/local/bin/gunicorn main:application -c /path/to/project/gunicorn.conf.py
|
||||
directory=/path/to/project
|
||||
user=nobody
|
||||
autostart=true
|
||||
|
||||
@ -50,6 +50,20 @@
|
||||
<div class="document" id="news">
|
||||
<h1 class="title">News</h1>
|
||||
<div class="section" id="id1">
|
||||
<h1>0.6.4 / 2010-03-08</h1>
|
||||
<ul class="simple">
|
||||
<li>Use cStringIO when it's possible (use less CPU and faster)</li>
|
||||
<li>Fix worker freeze when a remote connexion close unexpectedly.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h1>0.6.3 / 2010-03-07</h1>
|
||||
<ul class="simple">
|
||||
<li>Make HTTP parsing faster.</li>
|
||||
<li>Some fixes (see <a class="reference external" href="http://github.com/benoitc/gunicorn/commits/master">logs</a>)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h1>0.6.2 / 2010-03-01</h1>
|
||||
<ul class="simple">
|
||||
<li>Added support for chunked response.</li>
|
||||
@ -59,7 +73,7 @@
|
||||
<li>Workers are now murdered by age (the older is killed the first).</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<div class="section" id="id4">
|
||||
<h1>0.6.1 / 2010-02-24</h1>
|
||||
<ul class="simple">
|
||||
<li>Added gunicorn config file support for django admin command</li>
|
||||
@ -67,21 +81,21 @@
|
||||
<li>Removed TTIN/TTOU from workers which blocked other signals.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<div class="section" id="id5">
|
||||
<h1>0.6 / 2010-02-22</h1>
|
||||
<ul class="simple">
|
||||
<li>Added setproctitle</li>
|
||||
<li>Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id4">
|
||||
<div class="section" id="id6">
|
||||
<h1>0.5.1 / 2010-02-22</h1>
|
||||
<ul class="simple">
|
||||
<li>Fix umask</li>
|
||||
<li>Added debian packaging</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<div class="section" id="id7">
|
||||
<h1>0.5 / 2010-02-20</h1>
|
||||
<ul class="simple">
|
||||
<li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li>
|
||||
|
||||
@ -100,7 +100,8 @@ class Arbiter(object):
|
||||
return
|
||||
pid = self.valid_pidfile(path)
|
||||
if pid:
|
||||
if self.pidfile and path == self.pidfile and pid == os.getpid():
|
||||
if self._pidfile is not None and path == self._pidfile and \
|
||||
pid == os.getpid():
|
||||
return path
|
||||
raise RuntimeError("Already running on PID %s " \
|
||||
"(or pid file '%s' is stale)" % (os.getpid(), path))
|
||||
@ -120,8 +121,10 @@ class Arbiter(object):
|
||||
""" delete pidfile"""
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
if int(f.read() or 0) == self.pid:
|
||||
os.unlink(f)
|
||||
pid = int(f.read() or 0)
|
||||
|
||||
if pid == self.pid:
|
||||
os.unlink(path)
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -335,7 +338,7 @@ class Arbiter(object):
|
||||
"""
|
||||
if self.pidfile:
|
||||
old_pidfile = "%s.oldbin" % self.pidfile
|
||||
self.pidfile = old_pidfile
|
||||
self.pidfile = old_pidfile
|
||||
|
||||
self.reexec_pid = os.fork()
|
||||
if self.reexec_pid != 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user