Subprocess.popen在一段时间后不断创建僵尸并刷新它们

时间:2018-06-12 14:08:31

标签: python subprocess popen zombie-process

如何在下面的代码中避免创建僵尸进程。

for i, (incident, host_name) in enumerate(slm_incidents.limit(10)):
    try:
        subprocess.Popen(['python2.7', "cli.py", '--host', str(host_name), '--incidentID', str(incident.id)],
                         env=self.my_env, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    except:
        exc_info = sys.exc_info()
        traceback.print_exception(*exc_info)
        log(self.log_file, 'Issue: ')
        log(self.log_file, traceback.format_exc())
        log(self.log_file, 'Integration getting error in {}  process.'.format(i))
        self.fail_excecution += 1
        sleep(30)

0 个答案:

没有答案