We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
SIGTERM doesn't kill Sentry
I'm using the hosted version of Sentry, and I've set it up with `systemd`.
By default, when stopping, `systemd` uses `SIGTERM` to inform Sentry that it should pack up and "call it a day".

However, `sentry` starts killing itself off, then decides that it has a little more work to do, and starts right back up. Note the section `...brutally killing workers`:

![1xzqkso](https://cloud.githubusercontent.com/assets/7784737/13779222/390b7e1a-eaba-11e5-82b3-8ed9f361d86f.png)

```
$ /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py start'
Running service: 'http'
*** Starting uWSGI 2.0.12 (64bit) on [Tue Mar 15 13:25:08 2016] ***
compiled with version: 5.3.0 on 13 March 2016 22:11:11
os: Linux-4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016
nodename: ***`
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/sentry
detected binary path: /opt/sentry/bin/uwsgi
your processes number limit is 31932
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address 0.0.0.0:9000 fd 3
Python version: 2.7.11 (default, Mar  3 2016, 11:00:04)  [GCC 5.3.0]
Set PythonHome to /opt/sentry
Python main interpreter initialized at 0x1c3fef0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
setting request body buffering size to 65536 bytes
mapped 1922048 bytes (1877 KB) for 12 cores
*** Operational MODE: preforking+threaded ***
spawned uWSGI master process (pid: 1657)
spawned uWSGI worker 1 (pid: 1665, cores: 4)
spawned uWSGI worker 2 (pid: 1666, cores: 4)
spawned uWSGI worker 3 (pid: 1667, cores: 4)
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x1c3fef0 pid: 1665 (default app)
WSGI app 0 (mountpoint='') ready in 4 seconds on interpreter 0x1c3fef0 pid: 1667 (default app)
WSGI app 0 (mountpoint='') ready in 5 seconds on interpreter 0x1c3fef0 pid: 1666 (default app)

// Right here, SIGTERM sent to sentry

...brutally killing workers...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
binary reloading uWSGI...
chdir() to /home/sentry
closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
found fd 3 mapped to socket 0 (0.0.0.0:9000)
running /opt/sentry/bin/uwsgi
*** Starting uWSGI 2.0.12 (64bit) on [Tue Mar 15 13:25:29 2016] ***
compiled with version: 5.3.0 on 13 March 2016 22:11:11
os: Linux-4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016
nodename: ***
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/sentry
detected binary path: /opt/sentry/bin/uwsgi
your processes number limit is 31932
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 inherited INET address 0.0.0.0:9000 fd 3
Python version: 2.7.11 (default, Mar  3 2016, 11:00:04)  [GCC 5.3.0]
Set PythonHome to /opt/sentry
Python main interpreter initialized at 0x1bbf930
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
setting request body buffering size to 65536 bytes
mapped 1922048 bytes (1877 KB) for 12 cores
*** Operational MODE: preforking+threaded ***
gracefully (RE)spawned uWSGI master process (pid: 1657)
spawned uWSGI worker 1 (pid: 1702, cores: 4)
spawned uWSGI worker 2 (pid: 1703, cores: 4)
spawned uWSGI worker 3 (pid: 1704, cores: 4)

```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/sentry/services/http.py`
Content:
```
1 """
2 sentry.services.http
3 ~~~~~~~~~~~~~~~~~~~~
4 
5 :copyright: (c) 2010-2016 by the Sentry Team, see AUTHORS for more details.
6 :license: BSD, see LICENSE for more details.
7 """
8 from __future__ import absolute_import, print_function
9 
10 import os
11 import sys
12 from sentry.services.base import Service
13 
14 
15 def convert_options_to_env(options):
16     for k, v in options.iteritems():
17         if v is None:
18             continue
19         key = 'UWSGI_' + k.upper().replace('-', '_')
20         if isinstance(v, basestring):
21             value = v
22         elif v is True:
23             value = 'true'
24         elif v is False:
25             value = 'false'
26         elif isinstance(v, (int, long)):
27             value = str(v)
28         else:
29             raise TypeError('Unknown option type: %r (%s)' % (k, type(v)))
30         yield key, value
31 
32 
33 class SentryHTTPServer(Service):
34     name = 'http'
35 
36     def __init__(self, host=None, port=None, debug=False, workers=None,
37                  validate=True):
38         from django.conf import settings
39 
40         if validate:
41             self.validate_settings()
42 
43         host = host or settings.SENTRY_WEB_HOST
44         port = port or settings.SENTRY_WEB_PORT
45 
46         options = (settings.SENTRY_WEB_OPTIONS or {}).copy()
47         options.setdefault('module', 'sentry.wsgi:application')
48         options.setdefault('protocol', 'http')
49         options.setdefault('auto-procname', True)
50         options.setdefault('procname-prefix-spaced', '[Sentry]')
51         options.setdefault('workers', 3)
52         options.setdefault('threads', 4)
53         options.setdefault('http-timeout', 30)
54         options.setdefault('vacuum', True)
55         options.setdefault('thunder-lock', True)
56         options.setdefault('log-x-forwarded-for', False)
57         options.setdefault('buffer-size', 32768)
58         options.setdefault('post-buffering', 65536)
59         options.setdefault('limit-post', 20971520)
60         options.setdefault('need-app', True)
61         options.setdefault('disable-logging', False)
62         options.setdefault('memory-report', True)
63         options.setdefault('reload-on-rss', 600)
64         options.setdefault('ignore-sigpipe', True)
65         options.setdefault('ignore-write-errors', True)
66         options.setdefault('disable-write-exception', True)
67         options.setdefault('virtualenv', sys.prefix)
68         options.setdefault('log-format', '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"')
69 
70         options.setdefault('%s-socket' % options['protocol'], '%s:%s' % (host, port))
71 
72         # We only need to set uid/gid when stepping down from root, but if
73         # we are trying to run as root, then ignore it entirely.
74         uid = os.getuid()
75         if uid > 0:
76             options.setdefault('uid', uid)
77         gid = os.getgid()
78         if gid > 0:
79             options.setdefault('gid', gid)
80 
81         # Required arguments that should not be overridden
82         options['master'] = True
83         options['enable-threads'] = True
84         options['lazy-apps'] = True
85         options['single-interpreter'] = True
86 
87         if workers:
88             options['workers'] = workers
89 
90         # Old options from gunicorn
91         if 'bind' in options:
92             options['%s-socket' % options['protocol']] = options.pop('bind')
93         if 'accesslog' in options:
94             if options['accesslog'] != '-':
95                 options['logto'] = options['accesslog']
96             del options['accesslog']
97         if 'errorlog' in options:
98             if options['errorlog'] != '-':
99                 options['logto2'] = options['errorlog']
100             del options['errorlog']
101         if 'timeout' in options:
102             options['http-timeout'] = options.pop('timeout')
103         if 'proc_name' in options:
104             options['procname-prefix-spaced'] = options.pop('proc_name')
105         if 'secure_scheme_headers' in options:
106             del options['secure_scheme_headers']
107         if 'loglevel' in options:
108             del options['loglevel']
109 
110         self.options = options
111 
112     def validate_settings(self):
113         from django.conf import settings as django_settings
114         from sentry.utils.settings import validate_settings
115 
116         validate_settings(django_settings)
117 
118     def run(self):
119         # Move all of the options into UWSGI_ env vars
120         for k, v in convert_options_to_env(self.options):
121             os.environ.setdefault(k, v)
122 
123         # This has already been validated inside __init__
124         os.environ['SENTRY_SKIP_BACKEND_VALIDATION'] = '1'
125 
126         # Look up the bin directory where `sentry` exists, which should be
127         # sys.argv[0], then inject that to the front of our PATH so we can reliably
128         # find the `uwsgi` that's installed when inside virtualenv.
129         # This is so the virtualenv doesn't need to be sourced in, which effectively
130         # does exactly this.
131         virtualenv_path = os.path.dirname(os.path.abspath(sys.argv[0]))
132         current_path = os.environ.get('PATH', '')
133         if virtualenv_path not in current_path:
134             os.environ['PATH'] = '%s:%s' % (virtualenv_path, current_path)
135 
136         os.execvp('uwsgi', ('uwsgi',))
137
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/sentry/services/http.py b/src/sentry/services/http.py
--- a/src/sentry/services/http.py
+++ b/src/sentry/services/http.py
@@ -65,6 +65,7 @@
         options.setdefault('ignore-write-errors', True)
         options.setdefault('disable-write-exception', True)
         options.setdefault('virtualenv', sys.prefix)
+        options.setdefault('die-on-term', True)
         options.setdefault('log-format', '%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"')
 
         options.setdefault('%s-socket' % options['protocol'], '%s:%s' % (host, port))

{"golden_diff": "diff --git a/src/sentry/services/http.py b/src/sentry/services/http.py\n--- a/src/sentry/services/http.py\n+++ b/src/sentry/services/http.py\n@@ -65,6 +65,7 @@\n         options.setdefault('ignore-write-errors', True)\n         options.setdefault('disable-write-exception', True)\n         options.setdefault('virtualenv', sys.prefix)\n+        options.setdefault('die-on-term', True)\n         options.setdefault('log-format', '%(addr) - %(user) [%(ltime)] \"%(method) %(uri) %(proto)\" %(status) %(size) \"%(referer)\" \"%(uagent)\"')\n \n         options.setdefault('%s-socket' % options['protocol'], '%s:%s' % (host, port))\n", "issue": "SIGTERM doesn't kill Sentry\nI'm using the hosted version of Sentry, and I've set it up with `systemd`.\nBy default, when stopping, `systemd` uses `SIGTERM` to inform Sentry that it should pack up and \"call it a day\".\n\nHowever, `sentry` starts killing itself off, then decides that it has a little more work to do, and starts right back up. Note the section `...brutally killing workers`:\n\n![1xzqkso](https://cloud.githubusercontent.com/assets/7784737/13779222/390b7e1a-eaba-11e5-82b3-8ed9f361d86f.png)\n\n```\n$ /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py start'\nRunning service: 'http'\n*** Starting uWSGI 2.0.12 (64bit) on [Tue Mar 15 13:25:08 2016] ***\ncompiled with version: 5.3.0 on 13 March 2016 22:11:11\nos: Linux-4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016\nnodename: ***`\nmachine: x86_64\nclock source: unix\npcre jit disabled\ndetected number of CPU cores: 8\ncurrent working directory: /home/sentry\ndetected binary path: /opt/sentry/bin/uwsgi\nyour processes number limit is 31932\nyour memory page size is 4096 bytes\ndetected max file descriptor number: 1024\nlock engine: pthread robust mutexes\nthunder lock: enabled\nuwsgi socket 0 bound to TCP address 0.0.0.0:9000 fd 3\nPython version: 2.7.11 (default, Mar  3 2016, 11:00:04)  [GCC 5.3.0]\nSet PythonHome to /opt/sentry\nPython main interpreter initialized at 0x1c3fef0\npython threads support enabled\nyour server socket listen backlog is limited to 100 connections\nyour mercy for graceful operations on workers is 60 seconds\nsetting request body buffering size to 65536 bytes\nmapped 1922048 bytes (1877 KB) for 12 cores\n*** Operational MODE: preforking+threaded ***\nspawned uWSGI master process (pid: 1657)\nspawned uWSGI worker 1 (pid: 1665, cores: 4)\nspawned uWSGI worker 2 (pid: 1666, cores: 4)\nspawned uWSGI worker 3 (pid: 1667, cores: 4)\nWSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x1c3fef0 pid: 1665 (default app)\nWSGI app 0 (mountpoint='') ready in 4 seconds on interpreter 0x1c3fef0 pid: 1667 (default app)\nWSGI app 0 (mountpoint='') ready in 5 seconds on interpreter 0x1c3fef0 pid: 1666 (default app)\n\n// Right here, SIGTERM sent to sentry\n\n...brutally killing workers...\nworker 1 buried after 1 seconds\nworker 2 buried after 1 seconds\nworker 3 buried after 1 seconds\nbinary reloading uWSGI...\nchdir() to /home/sentry\nclosing all non-uwsgi socket fds > 2 (max_fd = 1024)...\nfound fd 3 mapped to socket 0 (0.0.0.0:9000)\nrunning /opt/sentry/bin/uwsgi\n*** Starting uWSGI 2.0.12 (64bit) on [Tue Mar 15 13:25:29 2016] ***\ncompiled with version: 5.3.0 on 13 March 2016 22:11:11\nos: Linux-4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016\nnodename: ***\nmachine: x86_64\nclock source: unix\npcre jit disabled\ndetected number of CPU cores: 8\ncurrent working directory: /home/sentry\ndetected binary path: /opt/sentry/bin/uwsgi\nyour processes number limit is 31932\nyour memory page size is 4096 bytes\ndetected max file descriptor number: 1024\nlock engine: pthread robust mutexes\nthunder lock: enabled\nuwsgi socket 0 inherited INET address 0.0.0.0:9000 fd 3\nPython version: 2.7.11 (default, Mar  3 2016, 11:00:04)  [GCC 5.3.0]\nSet PythonHome to /opt/sentry\nPython main interpreter initialized at 0x1bbf930\npython threads support enabled\nyour server socket listen backlog is limited to 100 connections\nyour mercy for graceful operations on workers is 60 seconds\nsetting request body buffering size to 65536 bytes\nmapped 1922048 bytes (1877 KB) for 12 cores\n*** Operational MODE: preforking+threaded ***\ngracefully (RE)spawned uWSGI master process (pid: 1657)\nspawned uWSGI worker 1 (pid: 1702, cores: 4)\nspawned uWSGI worker 2 (pid: 1703, cores: 4)\nspawned uWSGI worker 3 (pid: 1704, cores: 4)\n\n```\n\n", "before_files": [{"content": "\"\"\"\nsentry.services.http\n~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2016 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\nfrom __future__ import absolute_import, print_function\n\nimport os\nimport sys\nfrom sentry.services.base import Service\n\n\ndef convert_options_to_env(options):\n    for k, v in options.iteritems():\n        if v is None:\n            continue\n        key = 'UWSGI_' + k.upper().replace('-', '_')\n        if isinstance(v, basestring):\n            value = v\n        elif v is True:\n            value = 'true'\n        elif v is False:\n            value = 'false'\n        elif isinstance(v, (int, long)):\n            value = str(v)\n        else:\n            raise TypeError('Unknown option type: %r (%s)' % (k, type(v)))\n        yield key, value\n\n\nclass SentryHTTPServer(Service):\n    name = 'http'\n\n    def __init__(self, host=None, port=None, debug=False, workers=None,\n                 validate=True):\n        from django.conf import settings\n\n        if validate:\n            self.validate_settings()\n\n        host = host or settings.SENTRY_WEB_HOST\n        port = port or settings.SENTRY_WEB_PORT\n\n        options = (settings.SENTRY_WEB_OPTIONS or {}).copy()\n        options.setdefault('module', 'sentry.wsgi:application')\n        options.setdefault('protocol', 'http')\n        options.setdefault('auto-procname', True)\n        options.setdefault('procname-prefix-spaced', '[Sentry]')\n        options.setdefault('workers', 3)\n        options.setdefault('threads', 4)\n        options.setdefault('http-timeout', 30)\n        options.setdefault('vacuum', True)\n        options.setdefault('thunder-lock', True)\n        options.setdefault('log-x-forwarded-for', False)\n        options.setdefault('buffer-size', 32768)\n        options.setdefault('post-buffering', 65536)\n        options.setdefault('limit-post', 20971520)\n        options.setdefault('need-app', True)\n        options.setdefault('disable-logging', False)\n        options.setdefault('memory-report', True)\n        options.setdefault('reload-on-rss', 600)\n        options.setdefault('ignore-sigpipe', True)\n        options.setdefault('ignore-write-errors', True)\n        options.setdefault('disable-write-exception', True)\n        options.setdefault('virtualenv', sys.prefix)\n        options.setdefault('log-format', '%(addr) - %(user) [%(ltime)] \"%(method) %(uri) %(proto)\" %(status) %(size) \"%(referer)\" \"%(uagent)\"')\n\n        options.setdefault('%s-socket' % options['protocol'], '%s:%s' % (host, port))\n\n        # We only need to set uid/gid when stepping down from root, but if\n        # we are trying to run as root, then ignore it entirely.\n        uid = os.getuid()\n        if uid > 0:\n            options.setdefault('uid', uid)\n        gid = os.getgid()\n        if gid > 0:\n            options.setdefault('gid', gid)\n\n        # Required arguments that should not be overridden\n        options['master'] = True\n        options['enable-threads'] = True\n        options['lazy-apps'] = True\n        options['single-interpreter'] = True\n\n        if workers:\n            options['workers'] = workers\n\n        # Old options from gunicorn\n        if 'bind' in options:\n            options['%s-socket' % options['protocol']] = options.pop('bind')\n        if 'accesslog' in options:\n            if options['accesslog'] != '-':\n                options['logto'] = options['accesslog']\n            del options['accesslog']\n        if 'errorlog' in options:\n            if options['errorlog'] != '-':\n                options['logto2'] = options['errorlog']\n            del options['errorlog']\n        if 'timeout' in options:\n            options['http-timeout'] = options.pop('timeout')\n        if 'proc_name' in options:\n            options['procname-prefix-spaced'] = options.pop('proc_name')\n        if 'secure_scheme_headers' in options:\n            del options['secure_scheme_headers']\n        if 'loglevel' in options:\n            del options['loglevel']\n\n        self.options = options\n\n    def validate_settings(self):\n        from django.conf import settings as django_settings\n        from sentry.utils.settings import validate_settings\n\n        validate_settings(django_settings)\n\n    def run(self):\n        # Move all of the options into UWSGI_ env vars\n        for k, v in convert_options_to_env(self.options):\n            os.environ.setdefault(k, v)\n\n        # This has already been validated inside __init__\n        os.environ['SENTRY_SKIP_BACKEND_VALIDATION'] = '1'\n\n        # Look up the bin directory where `sentry` exists, which should be\n        # sys.argv[0], then inject that to the front of our PATH so we can reliably\n        # find the `uwsgi` that's installed when inside virtualenv.\n        # This is so the virtualenv doesn't need to be sourced in, which effectively\n        # does exactly this.\n        virtualenv_path = os.path.dirname(os.path.abspath(sys.argv[0]))\n        current_path = os.environ.get('PATH', '')\n        if virtualenv_path not in current_path:\n            os.environ['PATH'] = '%s:%s' % (virtualenv_path, current_path)\n\n        os.execvp('uwsgi', ('uwsgi',))\n", "path": "src/sentry/services/http.py"}], "after_files": [{"content": "\"\"\"\nsentry.services.http\n~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2016 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\nfrom __future__ import absolute_import, print_function\n\nimport os\nimport sys\nfrom sentry.services.base import Service\n\n\ndef convert_options_to_env(options):\n    for k, v in options.iteritems():\n        if v is None:\n            continue\n        key = 'UWSGI_' + k.upper().replace('-', '_')\n        if isinstance(v, basestring):\n            value = v\n        elif v is True:\n            value = 'true'\n        elif v is False:\n            value = 'false'\n        elif isinstance(v, (int, long)):\n            value = str(v)\n        else:\n            raise TypeError('Unknown option type: %r (%s)' % (k, type(v)))\n        yield key, value\n\n\nclass SentryHTTPServer(Service):\n    name = 'http'\n\n    def __init__(self, host=None, port=None, debug=False, workers=None,\n                 validate=True):\n        from django.conf import settings\n\n        if validate:\n            self.validate_settings()\n\n        host = host or settings.SENTRY_WEB_HOST\n        port = port or settings.SENTRY_WEB_PORT\n\n        options = (settings.SENTRY_WEB_OPTIONS or {}).copy()\n        options.setdefault('module', 'sentry.wsgi:application')\n        options.setdefault('protocol', 'http')\n        options.setdefault('auto-procname', True)\n        options.setdefault('procname-prefix-spaced', '[Sentry]')\n        options.setdefault('workers', 3)\n        options.setdefault('threads', 4)\n        options.setdefault('http-timeout', 30)\n        options.setdefault('vacuum', True)\n        options.setdefault('thunder-lock', True)\n        options.setdefault('log-x-forwarded-for', False)\n        options.setdefault('buffer-size', 32768)\n        options.setdefault('post-buffering', 65536)\n        options.setdefault('limit-post', 20971520)\n        options.setdefault('need-app', True)\n        options.setdefault('disable-logging', False)\n        options.setdefault('memory-report', True)\n        options.setdefault('reload-on-rss', 600)\n        options.setdefault('ignore-sigpipe', True)\n        options.setdefault('ignore-write-errors', True)\n        options.setdefault('disable-write-exception', True)\n        options.setdefault('virtualenv', sys.prefix)\n        options.setdefault('die-on-term', True)\n        options.setdefault('log-format', '%(addr) - %(user) [%(ltime)] \"%(method) %(uri) %(proto)\" %(status) %(size) \"%(referer)\" \"%(uagent)\"')\n\n        options.setdefault('%s-socket' % options['protocol'], '%s:%s' % (host, port))\n\n        # We only need to set uid/gid when stepping down from root, but if\n        # we are trying to run as root, then ignore it entirely.\n        uid = os.getuid()\n        if uid > 0:\n            options.setdefault('uid', uid)\n        gid = os.getgid()\n        if gid > 0:\n            options.setdefault('gid', gid)\n\n        # Required arguments that should not be overridden\n        options['master'] = True\n        options['enable-threads'] = True\n        options['lazy-apps'] = True\n        options['single-interpreter'] = True\n\n        if workers:\n            options['workers'] = workers\n\n        # Old options from gunicorn\n        if 'bind' in options:\n            options['%s-socket' % options['protocol']] = options.pop('bind')\n        if 'accesslog' in options:\n            if options['accesslog'] != '-':\n                options['logto'] = options['accesslog']\n            del options['accesslog']\n        if 'errorlog' in options:\n            if options['errorlog'] != '-':\n                options['logto2'] = options['errorlog']\n            del options['errorlog']\n        if 'timeout' in options:\n            options['http-timeout'] = options.pop('timeout')\n        if 'proc_name' in options:\n            options['procname-prefix-spaced'] = options.pop('proc_name')\n        if 'secure_scheme_headers' in options:\n            del options['secure_scheme_headers']\n        if 'loglevel' in options:\n            del options['loglevel']\n\n        self.options = options\n\n    def validate_settings(self):\n        from django.conf import settings as django_settings\n        from sentry.utils.settings import validate_settings\n\n        validate_settings(django_settings)\n\n    def run(self):\n        # Move all of the options into UWSGI_ env vars\n        for k, v in convert_options_to_env(self.options):\n            os.environ.setdefault(k, v)\n\n        # This has already been validated inside __init__\n        os.environ['SENTRY_SKIP_BACKEND_VALIDATION'] = '1'\n\n        # Look up the bin directory where `sentry` exists, which should be\n        # sys.argv[0], then inject that to the front of our PATH so we can reliably\n        # find the `uwsgi` that's installed when inside virtualenv.\n        # This is so the virtualenv doesn't need to be sourced in, which effectively\n        # does exactly this.\n        virtualenv_path = os.path.dirname(os.path.abspath(sys.argv[0]))\n        current_path = os.environ.get('PATH', '')\n        if virtualenv_path not in current_path:\n            os.environ['PATH'] = '%s:%s' % (virtualenv_path, current_path)\n\n        os.execvp('uwsgi', ('uwsgi',))\n", "path": "src/sentry/services/http.py"}]}