Skip to content

Commit ac188ae

Browse files
committed
fix threads error exit
1 parent 737c5f3 commit ac188ae

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

python/supervisor_healthCheck.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,12 @@ def action_kill(self, program, pid):
576576
:param program:
577577
:param pid:
578578
:return:
579-
"""
579+
"""
580580
self.log(program, 'Action: kill')
581581
result = 'success'
582582

583583
if int(pid) < 3:
584-
return 'Failed to kill %s, pid: %s '% (program, exitcode)
584+
return 'Failed to kill %s, pid: %s '% (program, pid)
585585

586586
cmd = "kill -9 %s" % pid
587587
exitcode, stdout, stderr = shell(cmd)
@@ -771,9 +771,15 @@ def start(self):
771771
t = threading.Thread(target=self.check, args=(item,))
772772
threads.append(t)
773773
for t in threads:
774-
t.setDaemon(True)
775-
t.start()
776-
774+
try:
775+
t.setDaemon(True)
776+
t.start()
777+
except Exception, e:
778+
print('Exception in ' + t.getName() + ' (catch by main)')
779+
print(t.exc_traceback)
780+
t.setDaemon(True)
781+
t.start()
782+
777783
while 1:
778784
time.sleep(0.1)
779785

0 commit comments

Comments
 (0)