Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Salt minion StreamClosedError when Salt Master IP changes #63654

Open
nick-stocks opened this issue Feb 7, 2023 · 2 comments
Open

[BUG] Salt minion StreamClosedError when Salt Master IP changes #63654

nick-stocks opened this issue Feb 7, 2023 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior needs-triage Transport

Comments

@nick-stocks
Copy link

nick-stocks commented Feb 7, 2023

Description
When a salt master's IP changes, a minion will lose its connection and fail continuously until the salt-minion service is restarted. Only then will it pick up the new IP

Seems to be a regression of issue 61482
Also reviewed PR 61577

Setup
Any salt minion/master setup with 3005.1 on both minion & master

Steps to Reproduce the behavior
Create a salt minion / master pair running 3005.1. Stop the salt-master, change its IP and start it back up.

Below error will appear continuously until the salt-minion has been restarted

2023-02-07 10:54:34,672 [salt.transport.tcp:625 ][WARNING ][498518] TCP Message Client encountered an exception while connecting to 192.168.0.5:4506: StreamClosedError('Stream is closed',), will reconnect in 1 seconds 

Expected behavior
After x timeout the salt minion should do a DNS lookup to validate the IP hasn't changed

Versions Report

[root@ip-192-168-0-13 bin]# salt-call --versions-report
Salt Version:
          Salt: 3005.1

Dependency Versions:
          cffi: 1.11.5
      cherrypy: Not Installed
      dateutil: 2.8.2
     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, Oct 20 2022, 09:31:56)
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 20.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: rhel 8.7 Ootpa
        locale: UTF-8
       machine: x86_64
       release: 4.18.0-425.10.1.el8_7.x86_64
        system: Linux
       version: Red Hat Enterprise Linux 8.7 Ootpa

Additional context
Have tried many different combinations of salt-minion config. None change the behaviour

Below constant

master_alive_interval: 15
random_startup_delay: 5
ping_interval: 1

Below tested for -1, 1 and 15

master_tries: -1

Below tested for both true and false values

auth_safemode

Also tested with and without the below

tcp_keepalive: True
tcp_keepalive_idle: 60
tcp_keepalive_cnt: 5
tcp_keepalive_intvl: 60
@nick-stocks nick-stocks added Bug broken, incorrect, or confusing behavior needs-triage labels Feb 7, 2023
@welcome
Copy link

welcome bot commented Feb 7, 2023

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@fraserOrr
Copy link

I'm seeing the same issue on the same version of salt with the DNS not resolving to a new IP after some machine cycling. I have the ping set, but even with the auth_safe mode im not seeing the minion restart at any point, which should force the new DNS resolution.

dwoz added a commit to dwoz/salt that referenced this issue Apr 23, 2024
Check for a chainging dns record anytime a minion gets disconnected from
it's master. See github issue saltstack#63654 saltstack#61482.
dwoz added a commit that referenced this issue Apr 25, 2024
Check for a chainging dns record anytime a minion gets disconnected from
it's master. See github issue #63654 #61482.
tacerus pushed a commit to tacerus/salt that referenced this issue Jan 16, 2025
* Minions check dns when re-connecting to a master

Check for a chainging dns record anytime a minion gets disconnected from
it's master. See github issue saltstack#63654 saltstack#61482.

* Regression tests for dns defined masters

Adding tests to validate we check for changing dns anytime we're
disconnected from the currently connected master

* Update docs for master dns changes

Update docs to use master_alive_interval to detect master ip changes via
DNS.

* Remove comment which is not true anymore

* Make minion reconnecting on changing master IP

with zeromq transport

* Don't create schedule for alive if no master_alive_interval

* Skip the tests if running with non-root user

* Skip if unable to set additional IP address

* Set master_tries to -1 for minions

* Fix the tests

---------

Co-authored-by: Daniel A. Wozniak <daniel.wozniak@broadcom.com>
agraul pushed a commit to agraul/salt that referenced this issue Jan 27, 2025
* Minions check dns when re-connecting to a master

Check for a chainging dns record anytime a minion gets disconnected from
it's master. See github issue saltstack#63654 saltstack#61482.

* Regression tests for dns defined masters

Adding tests to validate we check for changing dns anytime we're
disconnected from the currently connected master

* Update docs for master dns changes

Update docs to use master_alive_interval to detect master ip changes via
DNS.

* Remove comment which is not true anymore

* Make minion reconnecting on changing master IP

with zeromq transport

* Don't create schedule for alive if no master_alive_interval

* Skip the tests if running with non-root user

* Skip if unable to set additional IP address

* Set master_tries to -1 for minions

* Fix the tests

---------

Co-authored-by: Daniel A. Wozniak <daniel.wozniak@broadcom.com>

BACKPORT-UPSTREAM=saltstack#66422
BACKPORT-UPSTREAM=saltstack#66757
BACKPORT-UPSTREAM=saltstack#66760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage Transport
Projects
None yet
Development

No branches or pull requests

3 participants