salt icon indicating copy to clipboard operation
salt copied to clipboard

Only Initial Presence New Event Works in 3005.1 with TCP

Open tcarroll25 opened this issue 3 years ago • 1 comments

Description of Issue

After upgrading both master and minion to version 3005.1 presence events are not working correctly. Only the very first presence present and presence change new events works on the first connection. If the minion disconnects the presence lost event never happens. Upon a minion reconnecting there is no new presence change new event nor a new presence present event. However using the runner to query presence seems to work correctly. I will put detailed steps to reproduce below.

I use TCP as my transport. I used a runner to query the presence_events config field from the master directly:

[root@t144-dut1 centos]# t128-salt-run config.get presence_events
True

Setup

Master config snippet:

transport: tcp

tcp_keepalive: True
tcp_keepalive_idle: 5
tcp_keepalive_cnt: 3
tcp_keepalive_intvl: 20

presence_events: True

Minion config snippet:

tcp_authentication_retries: -1
tcp_keepalive_cnt: 3
tcp_keepalive_idle: 5
tcp_keepalive_intvl: 10
transport: tcp

Steps to Reproduce Issue

Install a 3005.1 master and minion. Use tcp for transport and enable presence events on the master. First I start with no minions connected to the master:

[root@t144-dut1 centos]# t128-salt-run manage.present
[root@t144-dut1 centos]# t128-salt-run manage.not_present
- t144-dut1.openstacklocal
- t144-dut2.openstacklocal
- t144-dut3.openstacklocal
- t144-dut4.openstacklocal

I start the first minion and see the initial new presence event:

2023-01-17 18:19:15,954 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut1.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:19:15.954112'}
2023-01-17 18:19:15,957 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal'], '_stamp': '2023-01-17T18:19:15.957224'}

I confirm my status with the runner:

[root@t144-dut1 centos]# t128-salt-run manage.present
- t144-dut1.openstacklocal
[root@t144-dut1 centos]# t128-salt-run manage.not_present
- t144-dut2.openstacklocal
- t144-dut3.openstacklocal
- t144-dut4.openstacklocal

I start the other three minions and see their initial presence new events:

Minion t144-dut3.openstacklocal connecting:

2023-01-17 18:20:45,286 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut3.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.285937'}
2023-01-17 18:20:45,288 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal'], '_stamp': '2023-01-17T18:20:45.288676'}

Minion t144-dut2.openstacklocal connecting:

2023-01-17 18:20:45,792 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut2.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.792476'}
2023-01-17 18:20:45,810 [salt.pillar      :71  ][DEBUG   ][24144] Determining pillar cache
2023-01-17 18:20:45,819 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal'], '_stamp': '2023-01-17T18:20:45.805521'}

Minion t144-dut4.openstacklocal connecting:

2023-01-17 18:20:58,428 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut4.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:58.428326'}
2023-01-17 18:20:58,432 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal', 't144-dut4.openstacklocal'], '_stamp': '2023-01-17T18:20:58.431965'}

I confirm my status with the runner:

[root@t144-dut1 centos]# t128-salt-run manage.present
- t144-dut1.openstacklocal
- t144-dut2.openstacklocal
- t144-dut3.openstacklocal
- t144-dut4.openstacklocal
[root@t144-dut1 centos]# t128-salt-run manage.not_present
[root@t144-dut1 centos]#

Now I stop all four minions and confirm with the runner that none are present:

[root@t144-dut1 centos]# t128-salt-run manage.present
[root@t144-dut1 centos]# t128-salt-run manage.not_present
- t144-dut1.openstacklocal
- t144-dut2.openstacklocal
- t144-dut3.openstacklocal
- t144-dut4.openstacklocal

However no presence lost event was ever sent. I can grep through the logs and see only the initial 4 presence change new events and 4 presence present events:

[root@t144-dut1 128technology]# cat saltMaster.log | grep presence
2023-01-17 18:19:15,954 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut1.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:19:15.954112'}
2023-01-17 18:19:15,957 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal'], '_stamp': '2023-01-17T18:19:15.957224'}
2023-01-17 18:20:45,286 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut3.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.285937'}
2023-01-17 18:20:45,288 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal'], '_stamp': '2023-01-17T18:20:45.288676'}
2023-01-17 18:20:45,792 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut2.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.792476'}
2023-01-17 18:20:45,819 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal'], '_stamp': '2023-01-17T18:20:45.805521'}
2023-01-17 18:20:58,428 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut4.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:58.428326'}
2023-01-17 18:20:58,432 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal', 't144-dut4.openstacklocal'], '_stamp': '2023-01-17T18:20:58.431965'}

I start all four minions again and confirm with the runner:

[root@t144-dut1 centos]# t128-salt-run manage.present
- t144-dut1.openstacklocal
- t144-dut2.openstacklocal
- t144-dut3.openstacklocal
- t144-dut4.openstacklocal
[root@t144-dut1 centos]# t128-salt-run manage.not_present

And there are no presence change new events or presence present events, only the original events from the first connections for each minion:

[root@t144-dut1 128technology]# cat saltMaster.log | grep presence
2023-01-17 18:19:15,954 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut1.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:19:15.954112'}
2023-01-17 18:19:15,957 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal'], '_stamp': '2023-01-17T18:19:15.957224'}
2023-01-17 18:20:45,286 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut3.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.285937'}
2023-01-17 18:20:45,288 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal'], '_stamp': '2023-01-17T18:20:45.288676'}
2023-01-17 18:20:45,792 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut2.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:45.792476'}
2023-01-17 18:20:45,819 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal'], '_stamp': '2023-01-17T18:20:45.805521'}
2023-01-17 18:20:58,428 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/change; data = {'new': ['t144-dut4.openstacklocal'], 'lost': [], '_stamp': '2023-01-17T18:20:58.428326'}
2023-01-17 18:20:58,432 [salt.utils.event :821 ][DEBUG   ][24137] Sending event: tag = salt/presence/present; data = {'present': ['t144-dut1.openstacklocal', 't144-dut3.openstacklocal', 't144-dut2.openstacklocal', 't144-dut4.openstacklocal'], '_stamp': '2023-01-17T18:20:58.431965'}

Versions Report

Master:

[root@t144-dut1 centos]# t128-salt --versions-report
Salt Version:
          Salt: 3005.1

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.6.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.6.8 (default, Jan 22 2021, 10:31:57)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 24.0.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: centos 7 Core
        locale: utf-8
       machine: x86_64
       release: 4.18.0-372.16.1.0.1.el8_6.x86_64
        system: Linux
       version: CentOS Linux 7 Core

Minion:

[root@t144-dut1 centos]# salt-call --versions-report
Salt Version:
          Salt: 3005.1

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.0
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.9.16 (main, Dec 14 2022, 15:49:15)
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: centos 7 Core
        locale: utf-8
       machine: x86_64
       release: 4.18.0-372.16.1.0.1.el8_6.x86_64
        system: Linux
       version: CentOS Linux 7 Core

tcarroll25 avatar Jan 17 '23 18:01 tcarroll25

Sorry I missed this the first time around but looks like this bug has been found but is not being fixed until 3006: https://github.com/saltstack/salt/issues/62826. That makes this entire release unusable for us 😭

tcarroll25 avatar Jan 17 '23 18:01 tcarroll25