Skip to content

reactor race condition. found in 2019.2.0 seen in other releases #54045

Closed

Description

@whytewolf

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

master (3).log

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

  1. whytewolf commented on Jul 29, 2019

    @whytewolf
    CollaboratorAuthor

    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.

  2. whytewolf commented on Jul 29, 2019

    @whytewolf
    CollaboratorAuthor

    zd-3944

  3. added
    ZD
    on Jul 29, 2019
  4. added this to the Approved milestone on Jul 30, 2019
  5. added
    bug
    severity-medium
    P3
    on Jul 30, 2019
  6. stale commented on Jan 8, 2020

    @stale

    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.

  7. whytewolf commented on Jan 8, 2020

    @whytewolf
    CollaboratorAuthor

    this is not stale

  8. stale commented on Jan 8, 2020

    @stale

    Thank you for updating this issue. It is no longer marked as stale.

  9. sagetherage commented on Jan 31, 2020

    @sagetherage
    Contributor

    @whytewolf this won't get marked stale any 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't

  10. whytewolf commented on Jan 31, 2020

    @whytewolf
    CollaboratorAuthor

    @sagetherage Yep, I ended up getting a flood of these when the timer was adjusted. but it all looks good now.

  11. sagetherage commented on Jan 31, 2020

    @sagetherage
    Contributor

    @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!

  12. 25 remaining items

  13. oeuftete commented on Sep 21, 2020

    @oeuftete
    Contributor

    @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.

  14. Ch3LL commented on Oct 5, 2020

    @Ch3LL
    Contributor

    Since #56513 is merged I am closing here

  15. lomeroe commented on Dec 2, 2020

    @lomeroe
    Contributor

    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.

    # salt-call -V
    Salt Version:
              Salt: 3002.2
    
    Dependency Versions:
              cffi: 1.11.5
          cherrypy: Not Installed
          dateutil: 2.6.1
         docker-py: Not Installed
             gitdb: Not Installed
         gitpython: Not Installed
            Jinja2: 2.10.1
           libgit2: Not Installed
          M2Crypto: 0.35.2
              Mako: Not Installed
           msgpack: 0.6.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         pycparser: 2.14
          pycrypto: Not Installed
      pycryptodome: Not Installed
            pygit2: Not Installed
            Python: 3.6.8 (default, Apr 16 2020, 01:36:27)
      python-gnupg: 0.4.6
            PyYAML: 3.12
             PyZMQ: 19.0.0
             smmap: Not Installed
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.3
    
    System Versions:
              dist: centos 8 Core
            locale: UTF-8
           machine: x86_64
           release: 4.18.0-193.28.1.el8_2.x86_64
            system: Linux
           version: CentOS Linux 8 Core
    
  16. oeuftete commented on Dec 2, 2020

    @oeuftete
    Contributor

    @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.

  17. lomeroe commented on Dec 2, 2020

    @lomeroe
    Contributor

    @oeuftete good info, thanks!

  18. sagetherage commented on Dec 16, 2020

    @sagetherage
    Contributor

    looks like #58853 was merged and will be in the Aluminium release, closing this issue

  19. oeuftete commented on Jan 12, 2021

    @oeuftete
    Contributor

    ZD-6199. 3002.2, reactors not involved, multiple concurrent orchestrations using inline pillar data, though.

  20. s0undt3ch commented on Jan 29, 2021

    @s0undt3ch
    Contributor

    @oeuftete so, this probably needs a new issue for the scenario you're facing?
    Or reopen this one?

  21. oeuftete commented on Jan 29, 2021

    @oeuftete
    Contributor

    @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.

  22. oeuftete commented on Mar 9, 2021

    @oeuftete
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

MagnesiumZDbugseverity-high

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions