Skip to content

Commit

Permalink
Merge pull request #735 from scottkmaxwell/add-debug_gc-config-option
Browse files Browse the repository at this point in the history
Add debug_gc option
  • Loading branch information
tarekziade committed Feb 23, 2014
2 parents 509cc42 + b1cde91 commit 8af7722
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion circus/arbiter.py
@@ -1,6 +1,7 @@
import errno
import logging
import os
import gc
from circus.fixed_threading import Thread, get_ident
import sys
from time import sleep
Expand Down Expand Up @@ -67,6 +68,9 @@ class Arbiter(object):
to /dev/null. (default: False)
- **debug** -- if True, adds a lot of debug info in the stdout (default:
False)
- **debug_gc** -- if True, does gc.set_debug(gc.DEBUG_LEAK) (default:
False)
to circusd to analyze problems (default: False)
- **proc_name** -- the arbiter process name
- **fqdn_prefix** -- a prefix for the unique identifier of the circus
instance on the cluster.
Expand All @@ -79,7 +83,7 @@ def __init__(self, watchers, endpoint, pubsub_endpoint, check_delay=1.0,
multicast_endpoint=None, plugins=None,
sockets=None, warmup_delay=0, httpd=False,
httpd_host='localhost', httpd_port=8080,
httpd_close_outputs=False, debug=False,
httpd_close_outputs=False, debug=False, debug_gc=False,
ssh_server=None, proc_name='circusd', pidfile=None,
loglevel=None, logoutput=None, fqdn_prefix=None, umask=None,
endpoint_owner=None):
Expand Down Expand Up @@ -131,6 +135,10 @@ def __init__(self, watchers, endpoint, pubsub_endpoint, check_delay=1.0,
else:
self.stdout_stream = self.stderr_stream = None

self.debug_gc = debug_gc
if debug_gc:
gc.set_debug(gc.DEBUG_LEAK)

# initializing circusd-stats as a watcher when configured
self.statsd = statsd
self.stats_endpoint = stats_endpoint
Expand Down Expand Up @@ -422,6 +430,7 @@ def load_from_config(cls, config_file, loop=None):
httpd_host=cfg.get('httpd_host', 'localhost'),
httpd_port=cfg.get('httpd_port', 8080),
debug=cfg.get('debug', False),
debug_gc=cfg.get('debug_gc', False),
ssh_server=cfg.get('ssh_server', None),
pidfile=cfg.get('pidfile', None),
loglevel=cfg.get('loglevel', None),
Expand Down
1 change: 1 addition & 0 deletions circus/config.py
Expand Up @@ -165,6 +165,7 @@ def _upper(items):
config['httpd_host'] = dget('circus', 'httpd_host', 'localhost', str)
config['httpd_port'] = dget('circus', 'httpd_port', 8080, int)
config['debug'] = dget('circus', 'debug', False, bool)
config['debug_gc'] = dget('circus', 'debug_gc', False, bool)
config['pidfile'] = dget('circus', 'pidfile')
config['loglevel'] = dget('circus', 'loglevel')
config['logoutput'] = dget('circus', 'logoutput')
Expand Down
4 changes: 4 additions & 0 deletions docs/source/for-ops/configuration.rst
Expand Up @@ -98,6 +98,10 @@ circus - single section
**debug**
If set to True, all Circus stout/stderr daemons are redirected to circusd
stdout/stderr (default: False)
**debug_gc**
If set to True, circusd outputs additional log info from the garbage
collector. This can be useful in tracking down memory leaks.
(default: False)
**pidfile**
The file that must be used to keep the daemon pid.
**umask**
Expand Down

0 comments on commit 8af7722

Please sign in to comment.