AMBARI-18063. Remove code for debugging memory leaks not to flood up the disk (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1b1283a6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1b1283a6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1b1283a6 Branch: refs/heads/branch-2.4 Commit: 1b1283a62b8d80add44ca1eb8c3df99034e7667f Parents: e07faed Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Mon Aug 8 17:35:15 2016 +0300 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Mon Aug 8 17:35:15 2016 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_agent/main.py | 45 -------------------- 1 file changed, 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1b1283a6/ambari-agent/src/main/python/ambari_agent/main.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py index 1fc445e..c0f7b81 100644 --- a/ambari-agent/src/main/python/ambari_agent/main.py +++ b/ambari-agent/src/main/python/ambari_agent/main.py @@ -37,51 +37,6 @@ def fix_subprocess_racecondition(): fix_subprocess_racecondition() -import gc -import traceback -import threading -import time - -MEMORY_LEAK_DEBUG_FILEPATH = "/var/log/ambari-agent/memory_leak_debug.out" - -def setup_memory_leak_debugger(): - gc.disable_old = gc.disable - gc.enable_old = gc.enable - gc.isenabled_old = gc.isenabled - - def print_debug_info(result): - time_prefix = time.strftime('%X %x') - thread_repr = repr(threading.currentThread()) - stack_trace = ''.join(traceback.format_stack()).strip() - - message = '{0} | {1}\n{2}\n'.format(time_prefix, thread_repr, stack_trace) - if result: - message = '{0}Result = {1}\n'.format(message, result) - - with open(MEMORY_LEAK_DEBUG_FILEPATH, "a") as f: - f.write(message) - - def disable_new(): - result = gc.disable_old() - print_debug_info(result) - return result - - def enable_new(): - result = gc.enable_old() - print_debug_info(result) - return result - - def isenabled_new(): - result = gc.isenabled_old() - print_debug_info(result) - return result - - gc.disable = disable_new - gc.enable = enable_new - gc.isenabled = isenabled_new - -setup_memory_leak_debugger() - import logging.handlers import logging.config import signal