1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +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 json
import logging import logging
import os import os
import signal
import pipes import pipes
import re import re
import stat import stat
@ -340,7 +341,10 @@ class BaseTask(Task):
# Refresh model instance from the database (to check cancel flag). # Refresh model instance from the database (to check cancel flag).
instance = self.update_model(instance.pk) instance = self.update_model(instance.pk)
if instance.cancel_flag: 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 canceled = True
if idle_timeout and (time.time() - last_stdout_update) > idle_timeout: if idle_timeout and (time.time() - last_stdout_update) > idle_timeout:
child.close(True) child.close(True)