mirror of https://github.com/ansible/ansible.git
Switch from multiprocessing.Queue to SimpleQueue (#80838)
parent
202195f5e4
commit
61157f6a9e
@ -0,0 +1,3 @@
|
|||||||
|
bugfixes:
|
||||||
|
- Switch result queue from a ``multiprocessing.queues.Queue` to ``multiprocessing.queues.SimpleQueue``, primarily to allow properly handling
|
||||||
|
pickling errors, to prevent an infinite hang waiting for task results
|
@ -1,3 +1,3 @@
|
|||||||
shippable/posix/group3
|
shippable/posix/group3
|
||||||
context/controller
|
context/controller
|
||||||
skip/macos
|
needs/target/test_utils
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright: Contributors to the Ansible project
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
from ansible.plugins.action import ActionBase
|
||||||
|
from jinja2 import Undefined
|
||||||
|
|
||||||
|
|
||||||
|
class ActionModule(ActionBase):
|
||||||
|
|
||||||
|
def run(self, tmp=None, task_vars=None):
|
||||||
|
return {'obj': Undefined('obj')}
|
@ -0,0 +1,3 @@
|
|||||||
|
shippable/posix/group5
|
||||||
|
context/controller
|
||||||
|
needs/target/test_utils
|
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ux
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
|
||||||
|
is_timeout() {
|
||||||
|
rv=$?
|
||||||
|
if [ "$rv" == "124" ]; then
|
||||||
|
echo "***hang detected, this likely means the strategy never received a result for the task***"
|
||||||
|
fi
|
||||||
|
exit $rv
|
||||||
|
}
|
||||||
|
|
||||||
|
trap "is_timeout" EXIT
|
||||||
|
|
||||||
|
../test_utils/scripts/timeout.py -- 10 ansible-playbook -i ../../inventory runme.yml -v "$@"
|
@ -0,0 +1,7 @@
|
|||||||
|
- hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- include_role:
|
||||||
|
name: result_pickle_error
|
||||||
|
# Just for caution loop 3 times to ensure no issues
|
||||||
|
loop: '{{ range(3) }}'
|
@ -0,0 +1,14 @@
|
|||||||
|
- name: Ensure pickling error doesn't cause a hang
|
||||||
|
result_pickle_error:
|
||||||
|
ignore_errors: true
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.msg == expected_msg
|
||||||
|
- result is failed
|
||||||
|
vars:
|
||||||
|
expected_msg: "cannot pickle 'Undefined' object"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: Success, no hang
|
@ -0,0 +1 @@
|
|||||||
|
hidden
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('duration', type=int)
|
||||||
|
parser.add_argument('command', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
p = subprocess.run(
|
||||||
|
' '.join(args.command),
|
||||||
|
shell=True,
|
||||||
|
timeout=args.duration,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
sys.exit(p.returncode)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
sys.exit(124)
|
Loading…
Reference in New Issue