We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7c70f2 commit 5aa256dCopy full SHA for 5aa256d
prometheus_client/exposition.py
@@ -173,6 +173,12 @@ def factory(cls, registry):
173
174
class _ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
175
"""Thread per request HTTP server."""
176
+ # Make worker threads "fire and forget". Beginning with Python 3.7 this
177
+ # prevents a memory leak because ``ThreadingMixIn`` starts to gather all
178
+ # non-daemon threads in a list in order to join on them at server close.
179
+ # Enabling daemon threads virtually makes ``_ThreadingSimpleServer`` the
180
+ # same as Python 3.7's ``ThreadingHTTPServer``.
181
+ daemon_threads = True
182
183
184
def start_http_server(port, addr='', registry=REGISTRY):
0 commit comments