8000 Fix #3383 we should not exit when the process represented by pid is running by mengxunQAQ · Pull Request #3402 · benoitc/gunicorn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix #3383 we should not exit when the process represented by pid is running #3402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions gunicorn/pidfile.py
5C11
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.

import errno
import os
import tempfile

Expand All @@ -19,13 +18,6 @@ def __init__(self, fname):
self.pid = None

def create(self, pid):
oldpid = self.validate()
if oldpid:
if oldpid == os.getpid():
return
msg = "Already running on PID %s (or pid file '%s' is stale)"
raise RuntimeError(msg % (oldpid, self.fname))

self.pid = pid

# Write pidfile
Expand Down Expand Up @@ -58,28 +50,3 @@ def unlink(self):
os.unlink(self.fname)
except Exception:
pass

def validate(self):
""" Validate pidfile and make it stale if needed"""
if not self.fname:
return
try:
with open(self.fname) as f:
try:
wpid = int(f.read())
except ValueError:
return

try:
os.kill(wpid, 0)
return wpid
except OSError as e:
if e.args[0] == errno.EPERM:
return wpid
if e.args[0] == errno.ESRCH:
return
raise
except OSError as e:
if e.args[0] == errno.ENOENT:
return
raise
0