Repository: ambari Updated Branches: refs/heads/branch-2.4 e07faed8e -> 1b1283a62 refs/heads/trunk 38d1e10fd -> 8c9ea6511
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/8c9ea651 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c9ea651 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c9ea651 Branch: refs/heads/trunk Commit: 8c9ea651129a8c1d4bfdbe49bf6c56a1b416d1aa Parents: 38d1e10 Author: Andrew Onishuk <[email protected]> Authored: Mon Aug 8 17:35:12 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Mon Aug 8 17:35:12 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/8c9ea651/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
