Open amalaguti opened 1 month ago
I discovered a little difference in behavior, if the minion is configured in multimaster (active/active), when the minion is started as service, net start salt-minion
, there is no /start event.
But when the minion is started in foreground, salt-minion -l debug
, I can randomly get a /start event in one or the other master, but not in both.
With the scheduler_before_connect
option removed, both masters get the /start event
The problem seems to be async/await functions not being called properly, something we've seen recently in another minion connection related issues.
@dwoz @twangboy I would like to ask your review on this core changes due the complexities of this part of the code and general minion connection process, I'm not sure if this are how you want thigs to work for the minion connection setup.
The problem seems to be in the
# Main Minion Tune In
def tune_in(self, start=True):
HERE
Inside this function, the function self.setup_scheduler()
is called which triggers the exception.
I simply changed the setup_scheduler()
function to be async async def setup_scheduler(self, before_connect=False):
. Just with this change the exception is not longer thrown.
I also changed the call to this function to use await: await self.setup_scheduler()
.
In addition, (I will mention this in a new issue), I've observed that this section of the code inside the #Main minion tune in def tune_in(self, start=True):
HERE
which is suppossed to setup_beacons and setup_scheduler when the options beacons_before_connect or scheduler_before_connect are true, does not seem to be ever triggered during the minion start up.
I added some logging messages and never seem to be called with start: True. There's another function async def _connect_minion(self, minion)
from which minion.tune_in() is called with start=False.
if start:
if self.opts.get("beacons_before_connect", False):
self.setup_beacons(before_connect=True)
if self.opts.get("scheduler_before_connect", False):
self.setup_scheduler(before_connect=True)
I tried this with multimaster setup, two masters, the tune_in() function seems to be executed once per master connected.
@barneysowood fyi
Description 3007.1 Windows minions with option
scheduler_before_connect: True
set throws exceptionTCP Publish Client encountered an exception while connecting to 127.0.0.1:4510: TimeoutError()
on start, and does not generate /start event on master event busNo /start event is shown, only auth
The minion seems responsive after start, but not having the /start event seems to be a big issue.
The
scheduler_before_connect
option is required in this use case and works fine in 3006.x versions.Setup 3007.x Windos minion with
scheduler_before_connect: True
Expected behavior Minion should start without the exception, the
scheduler_before_connect
should work as expected and /start event should be seeing on the event bus