salt icon indicating copy to clipboard operation
salt copied to clipboard

Reactor cmd/local infinite recursion

Open jacksontj opened this issue 12 years ago • 8 comments

If you configure the reactor to run on any event that is generated by firing a job to a minion (job ret, job pub, etc.) then the reactor will infinitely recurse on itself. This is because the cmd_async function (which it uses for firing the job to the minion) has no mechanism to disable firing an event-- meaning the reactor will react on events that originated from the reactor.

jacksontj avatar Nov 19 '14 16:11 jacksontj

Thanks for reporting this. What version of salt are you running? I believe @cachedout has made recent asynchronous changes to the reactor. You may even know more about this than me.

jfindlay avatar Nov 19 '14 17:11 jfindlay

This is reproducible in all versions of salt AFAIK (confirmed on 2014.7 and current develop).

This isn't so much a break as a design flaw ;) I had added some code in the past to not fire event (74b20cf), but this wasn't fixed for the cmd/local clients-- because there is no API to ask salt to not publish events (or have the reactor ignore them).

jacksontj avatar Nov 19 '14 20:11 jacksontj

The more I think about this I don't like the not firing events option. I'm thinking we either add another field to the event, or just always pass user="reactor" and just filter out all reactor events in the reactor.

jacksontj avatar Dec 24 '14 22:12 jacksontj

With the work I was doing over in the runners, I remembered this and it turns out that after the changes I made this is actually quite simple. The fix i have doesn't stop you from catching all events, but it does stop infinite recursion.

jacksontj avatar Dec 24 '14 22:12 jacksontj

@jacksontj Are you still working on this or can we close this?

justinta avatar Jun 16 '15 22:06 justinta

The specific case of returner in the reactor is fixed, but the other ones (local cmd etc.) are still an issue, which we still need to fix

jacksontj avatar Jun 17 '15 05:06 jacksontj

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.

stale[bot] avatar Nov 18 '17 18:11 stale[bot]

I don't see the rationale for adding "user":"Reactor" as event field and not gathering reactors for such.

Actually I do want to start e.g. orchestration via Reactor and do some cleanup actions after it completes. Aforementioned orchestration completes with one clean event salt/run/20180104200542718042/ret that I would like to match on Unfortunately I cannot because of "user":"Runner"

How can I attach reactors for the event of completion of reactor:

start_orchestration:
  runner.state.orchestrate:
    - args:
      - mods: _orchestrate.dummy.action
      - pillar:
          targets: {{ data['minions'] }}
      - saltenv: {{ saltenv }}

kiemlicz avatar Jan 04 '18 20:01 kiemlicz