Skip to content

Modules not available for some proxy minions #35443

Closed

Description

@mirceaulinic

Description of Issue/Question

From time to time, when executing a specific function against a groups of network devices managed through proxy minions using the NAPALM proxy, we encounter the following error:

# salt edge01.yyz01 ntp.peers
edge01.yyz01:
    'ntp.peers' is not available.
ERROR: Minions returned with non-zero exit code

In the example above, I have executed the function peers from the napalm_ntp module, having the virtual name ntp: https://github.com/saltstack/salt/blob/develop/salt/modules/napalm_ntp.py#L77

Executing the same function against a different target:

# salt edge01.akl01 ntp.peers
edge01.akl01:
    ----------
    comment:
    out:
        - 172.17.17.1
        - 172.17.17.2
    result:
        True

(I have obfuscated the IP addresses in previous output, otherwise nothing was changed).

But executing a different function (e.g. snmp.config - soon to be published) against the same minion as previously:

# salt edge01.akl01 snmp.config
edge01.akl01:
    'snmp.config' is not available.

Setup

The setup is the same as described in #34446, without the changes from #35178.

Steps to Reproduce Issue

Unfortunately I am not sure how to reproduce this issue. Given that I am still not aware of deeper Salt internals, I would need your guidance to identify the steps.
Initially I thought it is a caching issue - but the modules are cached in only one place for all proxies and they become unavailable only for some of them.
Restarting the proxy process fixes the problem, but this is not a comfortable solution since this kind of events are not deterministic (or, at least, I was not able to identify a pattern).
Sometimes we get the message * is not available a couple of hours after the proxy is started, sometimes after a couple of days.

Versions Report

# salt --versions-report
Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.6.4
      gitpython: 2.0.5
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.3
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.5
        machine: x86_64
        release: 4.1.3-cloudflare
         system: Linux
        version: debian 8.5

Activity

  1. Ch3LL commented on Aug 15, 2016

    @Ch3LL
    Contributor

    ping @cro could I get your input on this issue? Any advice as to why this might be occuring? Or maybe somewhere he can look to track this issue down?

    My only suggestion for right now is to check the debug logs when this occurs and see if there is any relevant logs. Thanks

  2. added
    pending-discussion
    on Aug 15, 2016
  3. added this to the Blocked milestone on Aug 15, 2016
  4. mirceaulinic commented on Aug 15, 2016

    @mirceaulinic
    ContributorAuthor

    Hi @Ch3LL,

    Being in a production environment, the log level was set to warning therefore the logs did not catch anything suspicious. I decreased to debug level and I will wait till this happens again when I will provide some more data for this ticket.

    Thanks,
    Mircea

  5. Ch3LL commented on Aug 16, 2016

    @Ch3LL
    Contributor

    Sounds great thanks @mirceaulinic

  6. mirceaulinic commented on Aug 19, 2016

    @mirceaulinic
    ContributorAuthor

    This issue happened today again.

    Please find the logs section below:

    2016-08-19 17:56:03,636 [salt.minion      ][INFO    ][19680] User sudo_mircea Executing command cfnet.anycast_route with jid 20160819175603626696
    2016-08-19 17:56:03,636 [salt.minion      ][DEBUG   ][19680] Command details {'tgt_type': 'glob', 'jid': '20160819175603626696', 'tgt': 'edge01.sjc01', 'ret': '', 'user': 'sudo_mircea', 'arg': ['del', '172.17.17.1/32', {'test': True, '__kwarg__': True}], 'fun': 'cfnet.anycast_route'}
    2016-08-19 17:56:03,676 [salt.minion      ][INFO    ][19680] Starting a new job with PID 19680
    2016-08-19 17:56:03,679 [salt.utils.lazy  ][DEBUG   ][19680] Could not LazyLoad cfnet.anycast_route
    2016-08-19 17:56:03,680 [salt.minion      ][DEBUG   ][19680] Minion return retry timer set to 8 seconds (randomized)
    2016-08-19 17:56:03,680 [salt.minion      ][INFO    ][19680] Returning information for job: 20160819175603626696
    2016-08-19 17:56:03,680 [salt.transport.zeromq][DEBUG   ][19680] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/proxy', 'edge01.sjc01', 'tcp://127.0.0.1:4506', 'aes')
    2016-08-19 17:56:03,680 [salt.crypt       ][DEBUG   ][19680] Initializing new AsyncAuth for ('/etc/salt/pki/proxy', 'edge01.sjc01', 'tcp://127.0.0.1:4506')
    

    Is there any other information I can provide?

  7. mirceaulinic commented on Aug 22, 2016

    @mirceaulinic
    ContributorAuthor

    @Ch3LL @cro

    I confirm that's all the information provided in the logs:

    Executing:

    # salt edge01.lax01 transit.depref dummy
    edge01.lax01:
        'transit.depref' is not available.
    ERROR: Minions returned with non-zero exit code

    Logs:

    2016-08-22 00:13:10,164 [salt.minion      ][INFO    ][19950] User sudo_mircea Executing command transit.depref with jid 20160822001310157711
    2016-08-22 00:13:10,165 [salt.minion      ][DEBUG   ][19950] Command details {'tgt_type': 'glob', 'jid': '20160822001310157711', 'tgt': 'edge01.lax01', 'ret': '', 'user': 'sudo_mircea', 'arg': ['dummy'], 'fun': 'transit.depref'}
    2016-08-22 00:13:10,207 [salt.minion      ][INFO    ][19950] Starting a new job with PID 19950
    2016-08-22 00:13:10,210 [salt.utils.lazy  ][DEBUG   ][19950] Could not LazyLoad transit.depref
    2016-08-22 00:13:10,211 [salt.minion      ][DEBUG   ][19950] Minion return retry timer set to 10 seconds (randomized)
    2016-08-22 00:13:10,211 [salt.minion      ][INFO    ][19950] Returning information for job: 20160822001310157711
    2016-08-22 00:13:10,211 [salt.transport.zeromq][DEBUG   ][19950] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/proxy', 'edge01.lax01', 'tcp://127.0.0.1:4506', 'aes')
    2016-08-22 00:13:10,212 [salt.crypt       ][DEBUG   ][19950] Initializing new AsyncAuth for ('/etc/salt/pki/proxy', 'edge01.lax01', 'tcp://127.0.0.1:4506')
    

    Although the minion replied for other requests such:

    # salt edge01.lax01 net.ping 8.8.8.8 count=1
    edge01.lax01:
        ----------
        comment:
        out:
            ----------
            success:
                ----------
                packet_loss:
                    0
                probes_sent:
                    1
                results:
                    |_
                      ----------
                      ip:
                          8.8.8.8
                      rtt:
                          0.576
                rtt_avg:
                    0.576
                rtt_max:
                    0.576
                rtt_min:
                    0.576
                rtt_stddev:
                    0.0
        result:
            True
  8. cro commented on Aug 22, 2016

    @cro
    Contributor

    @mirceaulinic I will look into this tomorrow.

  9. mirceaulinic commented on Aug 22, 2016

    @mirceaulinic
    ContributorAuthor

    Thanks @cro!

  10. cro commented on Aug 22, 2016

    @cro
    Contributor

    @mirceaulinic I've been looking over this and I know that pre #35178 proxies cache all the modules in the same place, but I am suspicious that #35178 might alleviate this. Is there any way for you to try that?

    (as an aside, thank you for the excellent bug reports.)

  11. mirceaulinic commented on Aug 22, 2016

    @mirceaulinic
    ContributorAuthor

    Great! Anyway I had in mind to put this week in the production the code from #35178 - most probably on Wednesday. Then I will come back with a feedback. Thank you!

    @cro thanks for appreciation! I am glad I can provide useful information :)

  12. mirceaulinic commented on Aug 23, 2016

    @mirceaulinic
    ContributorAuthor

    As a followup, I installed the code on a testing platform and I confirm it works as expected:

    # ls -la /var/cache/salt/proxy/
    total 8
    drwxr-xr-x 7 root root 200 Aug 23 14:55 .
    drwxr-xr-x 8 root root 160 Apr 29 16:42 ..
    drwxr-xr-x 4 root root 100 Aug 23 14:50 edge01.sfo04
    drwxr-xr-x 4 root root 100 Aug 23 14:55 edge01.sjc01

    One directory per minion - nice!

    Tomorrow I will push it into production.

  13. mirceaulinic commented on Aug 24, 2016

    @mirceaulinic
    ContributorAuthor

    Hi @cro,

    Today I upgraded our Salt production instance - please find versions report below:

    $ sudo salt --versions-report
    Salt Version:
               Salt: 2016.3.2-104-g962e493
    
    Dependency Versions:
               cffi: 1.7.0
           cherrypy: Not Installed
           dateutil: 2.2
              gitdb: 0.6.4
          gitpython: 2.0.5
              ioflo: Not Installed
             Jinja2: 2.8
            libgit2: Not Installed
            libnacl: Not Installed
           M2Crypto: 0.21.1
               Mako: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.4.8
       mysql-python: 1.2.5
          pycparser: 2.14
           pycrypto: 2.6.1
             pygit2: Not Installed
             Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
       python-gnupg: 0.3.8
             PyYAML: 3.11
              PyZMQ: 15.4.0
               RAET: Not Installed
              smmap: 0.9.0
            timelib: Not Installed
            Tornado: 4.4.1
                ZMQ: 4.1.5
    
    System Versions:
               dist: debian 8.5
            machine: x86_64
            release: 4.1.3-cloudflare
             system: Linux
            version: debian 8.5

    As on the testing server, the changes from #35178 created separate caching directories for each minion - which confirms yet again that works as expected (truncated output):

    # ls -la /var/cache/salt/proxy/
    total 3652
    drwxr-xr-x 82 root root    4096 Aug 24 09:17 .
    drwxr-xr-x  6 root root      63 Feb 25 09:56 ..
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.akl01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.ams01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.arn01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.atl01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.bkk01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.bom01
    drwxr-xr-x  4 root root      50 Aug 24 09:17 edge01.bos01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.bru01
    drwxr-xr-x  4 root root      50 Aug 24 09:09 edge01.cai01

    Unfortunately, just a few minutes ago, a colleague paste me the following:

    $  sudo salt edge01.iad02 transit.disable gtt
    /usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/grains/core.py:1493: DeprecationWarning: The "osmajorrelease" will be a type of an integer.
    edge01.iad02:
        'transit.disable' is not available.
    ERROR: Minions returned with non-zero exit code

    I do not have any log entries (as the log level has been increased again to warning), but I assume it should be similar as above.

    What would you suggest to do now, in order to help debugging?

    Also, upgrading to this version, on can notice that DeprecationWarning is raised whenever a command is executed. Is there a way to turn it off?

    Thank you!

  14. cro commented on Aug 24, 2016

    @cro
    Contributor

    Hi @mirceaulinic,

    Quick idea as I dive into this a little more--is the transit module located in /srv/salt/_modules? If so, did you do a sync_modules?

  15. mirceaulinic commented on Aug 24, 2016

    @mirceaulinic
    ContributorAuthor

    The source modules are located under /etc/salt/proxy-master/, which is specified in the master config file as:

    module_dirs:
      - /etc/salt/proxy-master

    I will expand a bit more on the steps I performed earlier today:

    • stop salt-proxy processes
    • stop salt-master
    • upgrade salt using pip install -U git+https://github.com/saltstack/[email protected]#egg=salt inside the Salt venv
    • start salt-master
    • start proxies

    I did not run sync_modules, but I was able to execute the modules immediately after restarting the proxy processes.

    Please let me know if that was correct. If not, what is the right way to sync_modules? I would like to remind you that this box is also a straight minion itself and salt-call saltutil.sync_modules would synchronise its modules instead of the proxy modules.
    Sometimes I use salt <proxy_name> saltutil.sync_modules, but my understanding was that will sync only for <proxy_name>. I am not sure about this though, would be actually quite good news if I am wrong :)

    Thank you!

  16. 49 remaining items

  17. added
    severity-medium
    P1
    and removed
    pending-discussion
    on Mar 14, 2017
  18. mirceaulinic commented on May 26, 2017

    @mirceaulinic
    ContributorAuthor

    @cro After the discussion from #41024, I am wondering if this may be related by any chance to the way we are defining the __virtual__ function. Do you think there could be a slight possibility to:

    • napalm becomes suddenly unavailable to be imported (I believe this is a very small chance)
    • the proxy key no longer available in the __opts__ (the proxy key is defined in the pillar.). Would you assume there might be a possibility that while the proxy process is alive, it can loose the pillar data merged in the opts?

    But in that case why does sync_all reload the modules, as in my comment above #35443 (comment)

  19. mirceaulinic commented on Jun 7, 2017

    @mirceaulinic
    ContributorAuthor

    As a followup (obivously to myself): checked when this happens and the proxy key still exists in the __opts__ (verified using test.get_opts).

  20. mirceaulinic commented on Jul 25, 2017

    @mirceaulinic
    ContributorAuthor

    Is this issue still scheduled to be solved in Nitrogen?
    Once again, I am happy to help, but I really don't know where to start from and awaiting an expert's input on this.

  21. modified the milestones: Nitrogen 5, Approved on Aug 30, 2017
  22. mirceaulinic commented on Nov 30, 2017

    @mirceaulinic
    ContributorAuthor

    This Pull Request #39948 might finally solve this issue.

  23. stale commented on Mar 25, 2019

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

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

Metadata

Metadata

Assignees

Labels

P1Proxy-Minionbugseverity-mediumstale

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions