You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dd...@apache.org on 2011/12/21 01:43:08 UTC
svn commit: r1221539 - in
/incubator/ambari/trunk/agent/src/main/python/ambari_agent: main.py shell.py
Author: ddas
Date: Wed Dec 21 00:43:07 2011
New Revision: 1221539
URL: http://svn.apache.org/viewvc?rev=1221539&view=rev
Log:
AMBARI-157. Fixed a signal handling issue.
Modified:
incubator/ambari/trunk/agent/src/main/python/ambari_agent/main.py
incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py
Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/main.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/main.py?rev=1221539&r1=1221538&r2=1221539&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/main.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/main.py Wed Dec 21 00:43:07 2011
@@ -32,6 +32,7 @@ from shell import getTempFiles
import AmbariConfig
logger = logging.getLogger()
+agentPid = os.getpid()
if 'AMBARI_PID_DIR' in os.environ:
pidfile = os.environ['AMBARI_PID_DIR'] + "/ambari-agent.pid"
@@ -44,6 +45,10 @@ else:
logfile = "/var/log/ambari/ambari-agent.log"
def signal_handler(signum, frame):
+ #we want the handler to run only for the agent process and not
+ #for the children (e.g. namenode, etc.)
+ if (os.getpid() != agentPid):
+ os._exit(0)
logger.info('signal received, exiting.')
try:
os.unlink(pidfile)
Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py?rev=1221539&r1=1221538&r2=1221539&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py Wed Dec 21 00:43:07 2011
@@ -139,8 +139,6 @@ class shellRunner:
child_pid = os.fork()
if child_pid == 0:
try:
- signal.signal(signal.SIGINT, SIG_DFL)
- signal.signal(signal.SIGTERM, SIG_DFL)
self.changeUid()
cmd = sys.executable
tmp = open(tempfilename, 'w')