1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Fix an issue where canceling jobs could leave orphaned and dead

ansible-playbook processes
This commit is contained in:
Matthew Jones 2014-08-26 10:20:10 -04:00
parent 47aac0dc7d
commit 6bccca2a9e

View File

@ -9,6 +9,7 @@ from distutils.version import StrictVersion as Version
import json
import logging
import os
import signal
import pipes
import re
import stat
@ -340,7 +341,10 @@ class BaseTask(Task):
# Refresh model instance from the database (to check cancel flag).
instance = self.update_model(instance.pk)
if instance.cancel_flag:
child.terminate(canceled)
os.kill(child.pid, signal.SIGINT)
time.sleep(3)
# The following line causes orphaned ansible processes
# child.terminate(canceled)
canceled = True
if idle_timeout and (time.time() - last_stdout_update) > idle_timeout:
child.close(True)