Skip to content

Commit b5d78e8

Browse files
authored
Merge pull request #1967 from skytoup/master
Fix #1965: About gunicorn [CRITICAL] Worker Timeout
2 parents bd734c5 + fd80918 commit b5d78e8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

gunicorn/arbiter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def murder_workers(self):
495495
workers = list(self.WORKERS.items())
496496
for (pid, worker) in workers:
497497
try:
498-
if time.time() - worker.tmp.last_update() <= self.timeout:
498+
if time.monotonic() - worker.tmp.last_update() <= self.timeout:
499499
continue
500500
except (OSError, ValueError):
501501
continue

gunicorn/workers/workertmp.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# See the NOTICE for more information.
55

66
import os
7+
import time
78
import platform
89
import tempfile
910

@@ -40,10 +41,11 @@ def __init__(self, cfg):
4041
raise
4142

4243
def notify(self):
43-
os.utime(self._tmp.fileno())
44+
new_time = time.monotonic()
45+
os.utime(self._tmp.fileno(), (new_time, new_time))
4446

4547
def last_update(self):
46-
return os.fstat(self._tmp.fileno()).st_ctime
48+
return os.fstat(self._tmp.fileno()).st_mtime
4749

4850
def fileno(self):
4951
return self._tmp.fileno()

0 commit comments

Comments
 (0)