This repository has been archived by the owner on Jun 26, 2018. It is now read-only.
forked from benoitc/gunicorn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reproduce seemingly ungraceful shutdown
- Loading branch information
Showing
5 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# To reproduce this: | ||
# $ virtualenv venv | ||
# $ ./venv/bin/python ./setup.py install | ||
# $ ./venv/bin/pip install requests | ||
|
||
# Then start the server: | ||
# $ ./venv/bin/python ./examples/standalone_app.py | ||
# Make note of the PID | ||
|
||
# In a different terminal start hammering the server: | ||
# $ ./venv/bin/python ./hammer.py | ||
# OR $ ./venv/bin/python ./hammer2.py | ||
|
||
# In yet a different terminal: | ||
# $ kill PID_HERE | ||
|
||
[2016-10-05 12:33:12 +0000] [24020] [INFO] Starting gunicorn 19.6.0 | ||
[2016-10-05 12:33:12 +0000] [24020] [INFO] Listening at: http://0.0.0.0:8080 (24020) | ||
[2016-10-05 12:33:12 +0000] [24020] [INFO] Using worker: sync | ||
[2016-10-05 12:33:12 +0000] [24028] [INFO] Booting worker with pid: 24028 | ||
handling request ... | ||
[2016-10-05 12:33:35 +0000] [24020] [INFO] Arbiter: Received signal 15 | ||
[2016-10-05 12:33:35 +0000] [24020] [INFO] Handling signal: term | ||
[2016-10-05 12:33:35 +0000] [24020] [INFO] Arbiter: Handle SIGTERM | ||
[2016-10-05 12:33:35 +0000] [24020] [INFO] gracefully closing socket ... | ||
handling request ... | ||
[2016-10-05 12:33:36 +0000] [24020] [INFO] waiting before gracefully closing socket, 0 | ||
handling request ... | ||
[2016-10-05 12:33:37 +0000] [24020] [INFO] waiting before gracefully closing socket, 1 | ||
handling request ... | ||
[2016-10-05 12:33:38 +0000] [24020] [INFO] waiting before gracefully closing socket, 2 | ||
[2016-10-05 12:33:38 +0000] [24020] [INFO] all server sockets should be closed by now | ||
[2016-10-05 12:33:38 +0000] [24020] [INFO] killing workers ... | ||
[2016-10-05 12:33:38 +0000] [24020] [INFO] killing workers in 3 ... | ||
handling request ... | ||
[2016-10-05 12:33:39 +0000] [24020] [INFO] killing workers in 2 ... | ||
handling request ... | ||
[2016-10-05 12:33:41 +0000] [24020] [INFO] killing workers in 1 ... | ||
[2016-10-05 12:33:41 +0000] [24020] [INFO] killing workers ... GO | ||
[2016-10-05 12:33:41 +0000] [24028] [INFO] Worker calling sys.exit(0) (pid: 24028) | ||
[2016-10-05 12:33:41 +0000] [24028] [INFO] Worker exiting (pid: 24028) | ||
[2016-10-05 12:33:41 +0000] [24020] [INFO] Arbiter: Handle SIGCHLD | ||
[2016-10-05 12:33:41 +0000] [24020] [INFO] Shutting down: Master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!./venv/bin/python | ||
|
||
from __future__ import print_function | ||
import requests | ||
import sys | ||
import signal | ||
from sets import Set | ||
from collections import OrderedDict | ||
|
||
if __name__=="__main__": | ||
print('hammer.py running ...') | ||
ok = 0 | ||
items = OrderedDict() | ||
while True: | ||
try: | ||
response = requests.get('http://localhost:8080/') | ||
if len(response.text) == 36: | ||
ok += 1 | ||
if response.text not in items.keys(): | ||
items[response.text] = 0 | ||
items[response.text] += 1 | ||
else: | ||
print('incorrect response, was', response.text) | ||
raise ValueError('Incorrect response', response.text) | ||
except: | ||
raise | ||
finally: | ||
sys.stdout.write("\rOK: %d. %s" % (ok, ", ".join(["%s: %d" % (k, v) for (k, v) in items.items()]))) | ||
sys.stdout.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
import os | ||
|
||
if __name__=="__main__": | ||
while True: | ||
ret = os.system('curl http://localhost:8080/') | ||
if ret == 0: | ||
pass | ||
else: | ||
print(ret) | ||
break | ||
print('exiting') |