You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/02/20 09:41:10 UTC
ambari git commit: AMBARI-20070. Agent heartbeat loop stuck in
subprocess.Popen (adoroszlai)
Repository: ambari
Updated Branches:
refs/heads/trunk 316d33a9b -> ac4f3d11f
AMBARI-20070. Agent heartbeat loop stuck in subprocess.Popen (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ac4f3d11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ac4f3d11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ac4f3d11
Branch: refs/heads/trunk
Commit: ac4f3d11f05637639638daf204cb9405ab9fe198
Parents: 316d33a
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Mon Feb 20 10:40:26 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Feb 20 10:40:26 2017 +0100
----------------------------------------------------------------------
.../src/main/python/ambari_agent/main.py | 23 ++++++++++++++++++++
1 file changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ac4f3d11/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 6927b15..5ca89b3 100644
--- a/ambari-agent/src/main/python/ambari_agent/main.py
+++ b/ambari-agent/src/main/python/ambari_agent/main.py
@@ -42,6 +42,29 @@ def fix_subprocess_racecondition():
del sys.modules['gc']
import gc
+
+def fix_subprocess_popen():
+ '''
+ http://bugs.python.org/issue19809
+ '''
+ import os
+ import sys
+
+ if os.name == 'posix' and sys.version_info[0] < 3:
+ import subprocess
+ import threading
+
+ original_init = subprocess.Popen.__init__
+ lock = threading.RLock()
+
+ def locked_init(self, *a, **kw):
+ with lock:
+ original_init(self, *a, **kw)
+
+ subprocess.Popen.__init__ = locked_init
+
+
+fix_subprocess_popen()
fix_subprocess_racecondition()
fix_encoding_reimport_bug()