Repository navigation
Description
Description of Issue
Looks like we have some kind of race condition in the reactor system when passing pillar data to orchestration.
Setup
The setup I used to test this was based on salt-api webhooks. to send data from the webhook into the reactor and carry that data into orchestration that holds saltify cloud.profile.
The reactors all rendered 100% correctly. But the orchestrations were all over the place. Some repeating pillar information and in one case no pillar information was rendered.
The orchestration that rendered without any pillar data came from an attempt to mitigate issue using sleep of 1 second in-between sending the webhooks
Steps to Reproduce Issue
config files
/etc/salt/cloud.providers.d/saltify.conf
salty:
driver: saltify
/etc/salt/cloud.profiles.d/saltify_host.conf
saltify_host:
provider: salty
force_minion_config: true
/etc/salt/master.d/*
rest_cherrypy:
port: 8000
webhook_disable_auth: True
disable_ssl: True
log_level_logfile: all
reactor:
- 'salt/netapi/hook/deploy_minion':
- /srv/salt/reactor/deploy_minion.sls
/srv/salt/reactor/deploy_minion.sls
# {{data}}
{% set post_data = data.get('post', {}) %}
#{{post_data}}
{% set host = post_data.get('host', '') %}
#{{host}}
{#
Initiate the Orchestration State
#}
deploy_minion_runner:
runner.state.orch:
- mods: orch.minion.deploy
- pillar:
params:
host: {{ host }}
/srv/salt/orch/minion/deploy.sls
{% set errors = [] %}
{% set params = salt['pillar.get']('params', {}) %}
{% if 'host' not in params %}
{% do errors.append('Please provide a host') %}
{% set host = '' %}
{% else %}
{% set host = params.get('host') %}
{% endif %}
{% if errors|length > 0 %}
preflight_check:
test.configurable_test_state:
- name: Additional information required
- changes: False
- result: False
- comment: '{{ errors|join(", ") }}'
{% else %}
preflight_check:
test.succeed_without_changes:
- name: 'All parameters accepted'
{% endif %}
provision_minion:
salt.runner:
- name: cloud.profile
- prof: saltify_host
- instances:
- {{ host }}
- require:
- preflight_check
- vm_overrides:
ssh_host: {{ host }}
ssh_username: centos
ssh_keyfile: /etc/salt/id_rsa
minion:
master:
- 172.16.22.60
- 172.16.22.115
sync_all:
salt.function:
- tgt: {{ host }}
- name: saltutil.sync_all
#execute_highstate:
# salt.state:
# - tgt: {{ host }}
# - highstate: True
Command run
for i in {1..8}; do curl localhost:8000/hook/deploy_minion -d host=test-${i}; done
As can be seen from the log.
deploy_minion.sls rendered in order
test-1
test-2
test-3
test-4
test-5
test-6
test-7
test-8
But deploy.sls
rendered in order
test-8
test-2
test-3
test-1
test-7
test-6
test-6
test-5
I have not found the cause of the issue yet.
Versions Report
Salt Version:
Salt: 2019.2.0
Dependency Versions:
cffi: Not Installed
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Jun 20 2019, 20:27:34)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-862.14.4.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core
Activity
whytewolf commentedon Jul 29, 2019
This seems to happen more if the orchestrations that the reactor runs are long-running. Moving to another setup that uses test.arg or some other orchestration that is over quickly doesn't trigger the issue.
whytewolf commentedon Jul 29, 2019
zd-3944
stale commentedon Jan 8, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
whytewolf commentedon Jan 8, 2020
this is not stale
stale commentedon Jan 8, 2020
Thank you for updating this issue. It is no longer marked as stale.
sagetherage commentedon Jan 31, 2020
@whytewolf this won't get marked
staleany further, we updated the config and this shouldn't be a problem any longer, let me know if you see it on other tickets, too, you shouldn'twhytewolf commentedon Jan 31, 2020
@sagetherage Yep, I ended up getting a flood of these when the timer was adjusted. but it all looks good now.
sagetherage commentedon Jan 31, 2020
@whytewolf Yes, we didn't communicate that very well (at all) and should have, and although we are on a better path, we still want to iterate on the config or use GH Actions. LMK if you have other ideas, love to hear it!
25 remaining items
oeuftete commentedon Sep 21, 2020
@theskabeater Yes, I just tested now the current master (04a0068) + a patch generated from #56513 and I'm seeing all of the reaction orchestrations happen now, once only, in the parallel and non-parallel cases. Great!
I'm also going to link in the issue at #58369 to make sure this issue is visible there.
Ch3LL commentedon Oct 5, 2020
Since #56513 is merged I am closing here
lomeroe commentedon Dec 2, 2020
Are there PRs other than #56513 that this fix is dependent on? 3002.2 appears to have all the modifications from that PR and I'm still seeing this issue.
oeuftete commentedon Dec 2, 2020
@lomeroe I will reopen this. The important memory leak fixes that went into 3002.2 reverted the changes that resolved this issue. I believe that pending PR #58853 will re-resolve this issue.
lomeroe commentedon Dec 2, 2020
@oeuftete good info, thanks!
sagetherage commentedon Dec 16, 2020
looks like #58853 was merged and will be in the Aluminium release, closing this issue
oeuftete commentedon Jan 12, 2021
ZD-6199. 3002.2, reactors not involved, multiple concurrent orchestrations using inline pillar data, though.
s0undt3ch commentedon Jan 29, 2021
@oeuftete so, this probably needs a new issue for the scenario you're facing?
Or reopen this one?
oeuftete commentedon Jan 29, 2021
@s0undt3ch I think we're OK with no new issue and keeping this closed. I added the comment just for Enterprise issue cross-referencing.
I believe the "new" issue is just a less common way to reproduce the issue of cross-talk in concurrent orchestrations with pillar data. The only difference (I think) is that the previous examples were (conveniently) triggered by reactors, whereas the recent one was via manual/API-driven orchestrations.
oeuftete commentedon Mar 9, 2021
Using the test case in #54045 (comment), tested with https://github.com/saltstack/salt/releases/tag/v3003rc1, and both the regular and parallel cases are working fine.