Skip to content

Commit

Permalink
Comment on memory leak prometheus#340
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Brandt <sebastian.brandt@friday.de>
  • Loading branch information
sbrandtb committed Dec 11, 2018
1 parent ef36e1c commit 51de8ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prometheus_client/exposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def factory(cls, registry):

class _ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
"""Thread per request HTTP server."""
# Make worker threads "fire and forget". Beginning with Python 3.7 this
# prevents a memory leak because ``ThreadingMixIn`` starts to gather all
# non-daemon threads in a list in order to join on them at server close.
# Enabling daemon threads virtually makes ``_ThreadingSimpleServer`` the
# same as Python 3.7's ``ThreadingHTTPServer``.
daemon_threads = True


Expand Down

0 comments on commit 51de8ba

Please sign in to comment.