salt icon indicating copy to clipboard operation
salt copied to clipboard

master auth delay

Open cavepopo opened this issue 8 years ago • 72 comments

Description of Issue/Question

using gitfs (pygit based) for states and external pillar, we are experiencing major performance drawback, the ratio from locally stored states and pillar and a gitfs based storage is about x5 (talking about time to complete setup). Local storage taking about 7/8 minutes when gitfs based master takes about 45 minutes to achieve the exact same setup. :(

for now I am just wondering (without real doubt though) if I am the only one to experience this ? I am quite sure I am, but I wanted to be sure first. Then I will be adding debug log and all this in this issue for tracking root cause.

So : Anyone experiencing this kind of performance using gitfs for state and external pillar ?

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) master / minion in latest (2018.3.2) as :

Salt Version:
           Salt: 2018.3.2
 
Dependency Versions:
           cffi: 1.11.4
       cherrypy: Not Installed
       dateutil: 2.2
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.3
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
 
System Versions:
           dist: debian 8.11 
         locale: UTF-8
        machine: x86_64
        release: 4.15.18-1-pve
         system: Linux
        version: debian 8.11 
 

cavepopo avatar Sep 09 '18 12:09 cavepopo

This is not typical performance but, of course, Salt's gitfs related to the performance of the git server itself. Do you have large objects in your repo? There are pretty well-known performance problems when serving large objects out of a git repo.

cachedout avatar Sep 10 '18 13:09 cachedout

Hi @cachedout , thanks for the answer, define large objects ? We do have some old war, the whole repo is about 2Go, is that too big ? I can see that for every request (state fetch) there is a 3 minutes "inactivity". I'll get some debug info and come back here.

cavepopo avatar Sep 10 '18 14:09 cavepopo

setting trace instead of debug might show more information if there is inactivity and debug is not showing anything just fyi. look forward to the logs :)

Ch3LL avatar Sep 10 '18 18:09 Ch3LL

Hi, Sorry for being so late, here is the log for some quite slow operation, a simple state apply that takes 20 seconds on a non-gitfs master, takes more than 1 minute here. https://gist.github.com/cavepopo/9090a45b7b408cfba34315cb82bdc53a

If you got any clues what causes such a big difference between gitfs and non-gitfs. Ping from master to gitlab server is normal (time=0.020ms)

cavepopo avatar Sep 26 '18 14:09 cavepopo

thanks for the logs. i'm not seeing anything that jumps out at me so I'm wondering if it is the war files/2GB size of the repo.

ping @terminalmage do you know if that sort of size could slow things down? The original question was "We do have some old war, the whole repo is about 2Go, is that too big ?"

Ch3LL avatar Sep 28 '18 17:09 Ch3LL

Unfortunately, that doesn't really tell us anything about fileclient requests, for that you'd need some logging from the minion. Trace logging is overkill, debug is fine. Please add the following to /etc/salt/minion on that machine:

log_level: '%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s'

Next, login to the minion and run time salt-call -l debug state.apply common.nslcd. It's not necessary to restart the salt-minion service after adding the above configuration, since salt-call runs in a new process, separate from the minion daemon.

terminalmage avatar Sep 28 '18 17:09 terminalmage

Here we go :

root@opendj1 [~]: time salt-call -l debug state.apply common.nslcd |tee -a /tmp/minion.log
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: opendj1.admin.ptf1
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] The `lspci` binary is not available on the system. GPU grains will not be available.
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Connecting to master. Attempt 1 of 1
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (5904)
[DEBUG   ] Setting zmq_reconnect_ivl to '5904ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'clear')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_2150d1a384_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
[DEBUG   ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2018-10-02T11:58:13.308831', 'creds': {'publish_port': 4505, 'aes': 'ZwDt8zohMtCSpFlgPL7gQovFEV1NyC0C0xsZOb1VBBVF/eYQofOXYK3g9UZbXbyzaIBwk2Zf/AM=', 'master_uri': 'tcp://10.101.10.56:4506'}, 'key': ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')}
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.apply
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')


[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] In saltenv 'base', looking at rel_path 'common/nslcd.sls' to resolve 'salt://common/nslcd.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/nslcd.sls' to resolve 'salt://common/nslcd.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://common/nslcd.sls'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'common/nslcd.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/common/nslcd.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nslcd.sls' using 'jinja' renderer: 0.00323104858398
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/common/nslcd.sls:
####### REQUIREMENTS
include:
  - common.nsswitch


######## NSLCD AUTH MODULE full state
#### pkg
nslcd:
  pkg.installed:
    - name: nslcd
  service:
    - enable: True
    - running

#### config file
nslcd_config_file:
  file.managed:
    - name: /etc/nslcd.conf
    - source: salt://common/files/auth/nslcd.conf
    - template: jinja
    - user: root
    - group: root
    - mode: 640
    - require:
      - pkg: nslcd
    - watch_in:
      - service: nslcd

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering: 
OrderedDict([('include', ['common.nsswitch']), ('nslcd', OrderedDict([('pkg.installed', [OrderedDict([('name', 'nslcd')])]), ('service', [OrderedDict([('enable', True)]), 'running'])])), ('nslcd_config_file', OrderedDict([('file.managed', [OrderedDict([('name', '/etc/nslcd.conf')]), OrderedDict([('source', 'salt://common/files/auth/nslcd.conf')]), OrderedDict([('template', 'jinja')]), OrderedDict([('user', 'root')]), OrderedDict([('group', 'root')]), OrderedDict([('mode', 640)]), OrderedDict([('require', [OrderedDict([('pkg', 'nslcd')])])]), OrderedDict([('watch_in', [OrderedDict([('service', 'nslcd')])])])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nslcd.sls' using 'yaml' renderer: 0.00685811042786
[DEBUG   ] In saltenv 'base', looking at rel_path 'common/nsswitch.sls' to resolve 'salt://common/nsswitch.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/nsswitch.sls' to resolve 'salt://common/nsswitch.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/common/nsswitch.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nsswitch.sls' using 'jinja' renderer: 0.000956058502197
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/common/nsswitch.sls:
######## NSSWITCH config file
nsswitch_config_file:
    file.managed:
      - name: /etc/nsswitch.conf
      - source: salt://common/files/auth/nsswitch.conf
      - user: root
      - group: root
      - mode: 644
[DEBUG   ] Results of YAML rendering: 
OrderedDict([('nsswitch_config_file', OrderedDict([('file.managed', [OrderedDict([('name', '/etc/nsswitch.conf')]), OrderedDict([('source', 'salt://common/files/auth/nsswitch.conf')]), OrderedDict([('user', 'root')]), OrderedDict([('group', 'root')]), OrderedDict([('mode', 644)])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nsswitch.sls' using 'yaml' renderer: 0.00209498405457
[DEBUG   ] LazyLoaded file.managed
[INFO    ] Running state [/etc/nsswitch.conf] at time 13:58:56.766240
[INFO    ] Executing state file.managed for /etc/nsswitch.conf
[DEBUG   ] LazyLoaded file.user_to_uid
[DEBUG   ] LazyLoaded cp.hash_file
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
[DEBUG   ] In saltenv 'base', looking at rel_path 'common/files/auth/nsswitch.conf' to resolve 'salt://common/files/auth/nsswitch.conf'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/files/auth/nsswitch.conf' to resolve 'salt://common/files/auth/nsswitch.conf'
[INFO    ] File /etc/nsswitch.conf is in the correct state
[INFO    ] Completed state [/etc/nsswitch.conf] at time 13:58:56.785831 duration_in_ms=19.591
[DEBUG   ] Module PSGet: Only available on Windows systems
[DEBUG   ] You should upgrade pyOpenSSL to at least 0.15.1 to enable the full use of X509 extensions in the tls module
[DEBUG   ] LazyLoaded service.start
[DEBUG   ] LazyLoaded service.running
[DEBUG   ] LazyLoaded pkg.installed
[DEBUG   ] Module DSC: Only available on Windows systems
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Generating function for user module
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [nslcd] at time 13:58:57.237898
[INFO    ] Executing state pkg.installed for nslcd
[INFO    ] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}\n', '-W'] in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[INFO    ] All specified packages are already installed
[INFO    ] Completed state [nslcd] at time 13:58:57.674831 duration_in_ms=436.933
[INFO    ] Running state [/etc/nslcd.conf] at time 13:58:57.675092
[INFO    ] Executing state file.managed for /etc/nslcd.conf
[DEBUG   ] In saltenv 'base', looking at rel_path 'common/files/auth/nslcd.conf' to resolve 'salt://common/files/auth/nslcd.conf'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/files/auth/nslcd.conf' to resolve 'salt://common/files/auth/nslcd.conf'
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[INFO    ] File /etc/nslcd.conf is in the correct state
[INFO    ] Completed state [/etc/nslcd.conf] at time 13:58:57.696569 duration_in_ms=21.477
[INFO    ] Running state [nslcd] at time 13:58:57.696746
[INFO    ] Executing state service.running for nslcd
[INFO    ] Executing command ['systemctl', 'status', 'nslcd.service', '-n', '0'] in directory '/root'
[DEBUG   ] stdout: ● nslcd.service - LSB: LDAP connection daemon
   Loaded: loaded (/etc/init.d/nslcd)
   Active: active (running) since Thu 2018-09-27 17:36:06 CEST; 4 days ago
  Process: 26339 ExecStop=/etc/init.d/nslcd stop (code=exited, status=0/SUCCESS)
  Process: 15190 ExecStart=/etc/init.d/nslcd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nslcd.service
           └─15198 /usr/sbin/nslcd
[INFO    ] Executing command ['systemctl', 'is-active', 'nslcd.service'] in directory '/root'
[DEBUG   ] output: active
[INFO    ] Executing command ['systemctl', 'is-enabled', 'nslcd.service'] in directory '/root'
[DEBUG   ] output: enabled
[INFO    ] The service nslcd is already running
[INFO    ] Completed state [nslcd] at time 13:58:57.809551 duration_in_ms=112.804
[DEBUG   ] File /var/cache/salt/minion/accumulator/140172865696720 does not exist, no need to cleanup.
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
[DEBUG   ] LazyLoaded highstate.output
local:
----------
          ID: nsswitch_config_file
    Function: file.managed
        Name: /etc/nsswitch.conf
      Result: True
     Comment: File /etc/nsswitch.conf is in the correct state
     Started: 13:58:56.766240
    Duration: 19.591 ms
     Changes:   
----------
          ID: nslcd
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 13:58:57.237898
    Duration: 436.933 ms
     Changes:   
----------
          ID: nslcd_config_file
    Function: file.managed
        Name: /etc/nslcd.conf
      Result: True
     Comment: File /etc/nslcd.conf is in the correct state
     Started: 13:58:57.675092
    Duration: 21.477 ms
     Changes:   
----------
          ID: nslcd
    Function: service.running
      Result: True
     Comment: The service nslcd is already running
     Started: 13:58:57.696747
    Duration: 112.804 ms
     Changes:   

Summary for local
------------
Succeeded: 4
Failed:    0
------------
Total states run:     4
Total run time: 590.805 ms

real	0m45.907s
user	0m1.751s
sys	0m0.752s

cavepopo avatar Oct 02 '18 12:10 cavepopo

I'm sorry, I mistyped above. Instead of setting log_level to that value, I needed you to set log_fmt_console. Doing that will make salt-call add in timestamps that will help us see where any slowdown may have occurred.

Could you repeat the above after setting log_fmt_console? Sorry again.

terminalmage avatar Oct 02 '18 13:10 terminalmage

Yep I saw that but I guessed you were looking for something specific in that log, anyway here the time stamped log :

 root@opendj1 [~]: time salt-call -l debug state.apply common.nslcd
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: opendj1.admin.ptf2
09:47:51,055 [salt.utils.parsers:234 ][DEBUG   ][5147] Configuration file path: /etc/salt/minion
09:47:51,055 [salt.utils.verify:535 ][WARNING ][5147] Insecure logging configuration detected! Sensitive data may be logged.
09:47:51,056 [salt.loader      :697 ][DEBUG   ][5147] Grains refresh requested. Refreshing grains.
09:47:51,056 [salt.config      :2117][DEBUG   ][5147] Reading configuration from /etc/salt/minion
09:47:51,057 [salt.config      :2260][DEBUG   ][5147] Including configuration from '/etc/salt/minion.d/_schedule.conf'
09:47:51,057 [salt.config      :2117][DEBUG   ][5147] Reading configuration from /etc/salt/minion.d/_schedule.conf
09:47:51,510 [salt.loaded.int.grains.core                           :179 ][DEBUG   ][5147] The `lspci` binary is not available on the system. GPU grains will not be available.
09:47:51,538 [salt.loaded.int.grains.core                           :598 ][DEBUG   ][5147] Please install 'virt-what' to improve results of the 'virtual' grain.
09:47:51,603 [salt.loaded.int.grains.extra                          :70  ][DEBUG   ][5147] Loading static grains from /etc/salt/grains
09:47:51,632 [salt.minion                                           :674 ][DEBUG   ][5147] Connecting to master. Attempt 1 of 1
09:47:51,633 [salt.minion                                           :237 ][DEBUG   ][5147] Master URI: tcp://10.201.10.56:4506
09:47:51,646 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:47:51,652 [salt.transport.zeromq                                 :388 ][DEBUG   ][5147] Generated random reconnect delay between '1000ms' and '11000ms' (1183)
09:47:51,652 [salt.transport.zeromq                                 :391 ][DEBUG   ][5147] Setting zmq_reconnect_ivl to '1183ms'
09:47:51,652 [salt.transport.zeromq                                 :397 ][DEBUG   ][5147] Setting zmq_reconnect_ivl_max to '11000ms'
09:47:51,652 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', 'clear')
09:47:51,652 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:47:51,653 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:47:51,653 [salt.crypt                                            :207 ][DEBUG   ][5147] salt.crypt.get_rsa_pub_key: Loading public key
09:47:51,668 [salt.crypt                                            :847 ][DEBUG   ][5147] Decrypting the current master AES key
09:47:51,668 [salt.crypt                                            :199 ][DEBUG   ][5147] salt.crypt.get_rsa_key: Loading private key
09:47:51,668 [salt.crypt                                            :179 ][DEBUG   ][5147] salt.crypt._get_key_with_evict: Loading private key
09:47:51,668 [salt.crypt                                            :776 ][DEBUG   ][5147] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:47:51,696 [salt.crypt                                            :207 ][DEBUG   ][5147] salt.crypt.get_rsa_pub_key: Loading public key
09:47:51,724 [salt.transport.zeromq                                 :437 ][DEBUG   ][5147] Connecting the Minion to the Master publish port, using the URI: tcp://10.201.10.56:4505
09:47:51,724 [salt.crypt                                            :199 ][DEBUG   ][5147] salt.crypt.get_rsa_key: Loading private key
09:47:51,724 [salt.crypt                                            :776 ][DEBUG   ][5147] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:47:51,751 [salt.pillar                                           :58  ][DEBUG   ][5147] Determining pillar cache
09:47:51,751 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:47:51,752 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:47:51,752 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:47:51,756 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:47:51,981 [salt.crypt                                            :199 ][DEBUG   ][5147] salt.crypt.get_rsa_key: Loading private key
09:47:51,981 [salt.crypt                                            :776 ][DEBUG   ][5147] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:47:52,039 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded jinja.render
09:47:52,039 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded yaml.render
09:47:52,042 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded state.apply
09:47:52,044 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded saltutil.is_running
09:47:52,044 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded grains.get
09:47:52,049 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded config.get
09:47:52,053 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:47:52,053 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:47:52,054 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:47:52,058 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506


09:48:36,943 [salt.state                                            :923 ][INFO    ][5147] Loading fresh modules for state activity
09:48:36,976 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded jinja.render
09:48:36,976 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded yaml.render
09:48:36,989 [salt.fileclient                                       :1124][DEBUG   ][5147] In saltenv 'base', looking at rel_path 'common/nslcd.sls' to resolve 'salt://common/nslcd.sls'
09:48:36,990 [salt.fileclient                                       :1132][DEBUG   ][5147] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/nslcd.sls' to resolve 'salt://common/nslcd.sls'
09:48:36,990 [salt.template                                         :51  ][DEBUG   ][5147] compile template: /var/cache/salt/minion/files/base/common/nslcd.sls
09:48:36,991 [salt.utils.jinja                                      :69  ][DEBUG   ][5147] Jinja search path: [u'/var/cache/salt/minion/files/base']
09:48:36,996 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:48:36,996 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:48:36,997 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:48:36,998 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:48:36,998 [salt.utils.templates                                  :345 ][DEBUG   ][5147] Jinja2 environment trim_blocks was set to True by jinja_sls_env
09:48:36,998 [salt.utils.templates                                  :345 ][DEBUG   ][5147] Jinja2 environment lstrip_blocks was set to True by jinja_sls_env
09:48:37,004 [salt.template                                         :26  ][PROFILE ][5147] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nslcd.sls' using 'jinja' renderer: 0.0129718780518
09:48:37,004 [salt.template                                         :113 ][DEBUG   ][5147] Rendered data from file: /var/cache/salt/minion/files/base/common/nslcd.sls:
####### REQUIREMENTS
include:
  - common.nsswitch


######## NSLCD AUTH MODULE full state
#### pkg
nslcd:
  pkg.installed:
    - name: nslcd
  service:
    - enable: True
    - running

#### config file
nslcd_config_file:
  file.managed:
    - name: /etc/nslcd.conf
    - source: salt://common/files/auth/nslcd.conf
    - template: jinja
    - user: root
    - group: root
    - mode: 640
    - require:
      - pkg: nslcd
    - watch_in:
      - service: nslcd

09:48:37,012 [salt.loaded.int.render.yaml                           :68  ][DEBUG   ][5147] Results of YAML rendering: 
OrderedDict([(u'include', [u'common.nsswitch']), (u'nslcd', OrderedDict([(u'pkg.installed', [OrderedDict([(u'name', u'nslcd')])]), (u'service', [OrderedDict([(u'enable', True)]), u'running'])])), (u'nslcd_config_file', OrderedDict([(u'file.managed', [OrderedDict([(u'name', u'/etc/nslcd.conf')]), OrderedDict([(u'source', u'salt://common/files/auth/nslcd.conf')]), OrderedDict([(u'template', u'jinja')]), OrderedDict([(u'user', u'root')]), OrderedDict([(u'group', u'root')]), OrderedDict([(u'mode', 640)]), OrderedDict([(u'require', [OrderedDict([(u'pkg', u'nslcd')])])]), OrderedDict([(u'watch_in', [OrderedDict([(u'service', u'nslcd')])])])])]))])
09:48:37,012 [salt.template                                         :26  ][PROFILE ][5147] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nslcd.sls' using 'yaml' renderer: 0.00806307792664
09:48:37,025 [salt.fileclient                                       :1124][DEBUG   ][5147] In saltenv 'base', looking at rel_path 'common/nsswitch.sls' to resolve 'salt://common/nsswitch.sls'
09:48:37,025 [salt.fileclient                                       :1132][DEBUG   ][5147] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/nsswitch.sls' to resolve 'salt://common/nsswitch.sls'
09:48:37,025 [salt.template                                         :51  ][DEBUG   ][5147] compile template: /var/cache/salt/minion/files/base/common/nsswitch.sls
09:48:37,026 [salt.utils.jinja                                      :69  ][DEBUG   ][5147] Jinja search path: [u'/var/cache/salt/minion/files/base']
09:48:37,030 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:48:37,030 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:48:37,031 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:48:37,033 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:48:37,033 [salt.utils.templates                                  :345 ][DEBUG   ][5147] Jinja2 environment trim_blocks was set to True by jinja_sls_env
09:48:37,033 [salt.utils.templates                                  :345 ][DEBUG   ][5147] Jinja2 environment lstrip_blocks was set to True by jinja_sls_env
09:48:37,034 [salt.template                                         :26  ][PROFILE ][5147] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nsswitch.sls' using 'jinja' renderer: 0.00836706161499
09:48:37,034 [salt.template                                         :113 ][DEBUG   ][5147] Rendered data from file: /var/cache/salt/minion/files/base/common/nsswitch.sls:
######## NSSWITCH config file
nsswitch_config_file:
    file.managed:
      - name: /etc/nsswitch.conf
      - source: salt://common/files/auth/nsswitch.conf
      - user: root
      - group: root
      - mode: 644
09:48:37,036 [salt.loaded.int.render.yaml                           :68  ][DEBUG   ][5147] Results of YAML rendering: 
OrderedDict([(u'nsswitch_config_file', OrderedDict([(u'file.managed', [OrderedDict([(u'name', u'/etc/nsswitch.conf')]), OrderedDict([(u'source', u'salt://common/files/auth/nsswitch.conf')]), OrderedDict([(u'user', u'root')]), OrderedDict([(u'group', u'root')]), OrderedDict([(u'mode', 644)])])]))])
09:48:37,036 [salt.template                                         :26  ][PROFILE ][5147] Time (in seconds) to render '/var/cache/salt/minion/files/base/common/nsswitch.sls' using 'yaml' renderer: 0.00191283226013
09:48:37,037 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded config.option
09:48:37,043 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded file.managed
09:48:37,043 [salt.state                                            :1789][INFO    ][5147] Running state [/etc/nsswitch.conf] at time 09:48:37.043616
09:48:37,043 [salt.state                                            :1822][INFO    ][5147] Executing state file.managed for [/etc/nsswitch.conf]
09:48:37,049 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded file.user_to_uid
09:48:37,050 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded cp.hash_file
09:48:37,054 [salt.transport.zeromq                                 :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:48:37,054 [salt.crypt                                            :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:48:37,055 [salt.transport.zeromq                                 :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:48:37,055 [salt.transport.zeromq                                 :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:48:37,072 [salt.fileclient                                       :1124][DEBUG   ][5147] In saltenv 'base', looking at rel_path 'common/files/auth/nsswitch.conf' to resolve 'salt://common/files/auth/nsswitch.conf'
09:48:37,072 [salt.fileclient                                       :1132][DEBUG   ][5147] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/files/auth/nsswitch.conf' to resolve 'salt://common/files/auth/nsswitch.conf'
09:48:37,074 [salt.state                                            :308 ][INFO    ][5147] File /etc/nsswitch.conf is in the correct state
09:48:37,074 [salt.state                                            :1968][INFO    ][5147] Completed state [/etc/nsswitch.conf] at time 09:48:37.074297 (duration_in_ms=30.685)
09:48:37,080 [salt.utils.lazy                                       :100 ][DEBUG   ][5147] LazyLoaded systemd.booted
09:48:37,462 [salt.utils.lazy                                                  :100 ][DEBUG   ][5147] LazyLoaded service.start
09:48:37,462 [salt.utils.lazy                                                  :100 ][DEBUG   ][5147] LazyLoaded service.running
09:48:37,464 [salt.utils.lazy                                                  :100 ][DEBUG   ][5147] LazyLoaded pkg.installed
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.iptables
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.puppet_resource
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.mount_point
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.group
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.socket
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.service
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.package
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.process
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.sudo
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.pip_package
09:48:37,477 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.sysctl
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.system_info
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.ansible
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.command
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.facter
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.file
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.interface
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.supervisor
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.salt
09:48:37,478 [salt.loaded.int.module.testinframod                              :220 ][DEBUG   ][5147] Generating function for testinfra.user
09:48:37,481 [salt.loaded.int.module.tls                                       :151 ][DEBUG   ][5147] You should upgrade pyOpenSSL to at least 0.15.1 to enable the full use of X509 extensions in the tls module
09:48:37,593 [salt.loaded.int.module.win_dsc                                   :43  ][DEBUG   ][5147] DSC: Only available on Windows systems
09:48:37,600 [salt.loaded.int.module.win_psget                                 :36  ][DEBUG   ][5147] Module PSGet: Only available on Windows systems
09:48:37,632 [salt.utils.lazy                                                  :103 ][DEBUG   ][5147] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
09:48:37,632 [salt.state                                                       :1789][INFO    ][5147] Running state [nslcd] at time 09:48:37.632681
09:48:37,632 [salt.state                                                       :1822][INFO    ][5147] Executing state pkg.installed for [nslcd]
09:48:37,639 [salt.utils.lazy                                                  :103 ][DEBUG   ][5147] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
09:48:37,639 [salt.loaded.int.module.cmdmod                                    :392 ][INFO    ][5147] Executing command [u'dpkg-query', u'--showformat', u'${Status} ${Package} ${Version} ${Architecture}', u'-W'] in directory '/root'
09:48:38,004 [salt.utils.lazy                                                  :103 ][DEBUG   ][5147] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
09:48:38,004 [salt.state                                                       :308 ][INFO    ][5147] All specified packages are already installed
09:48:38,005 [salt.state                                                       :1968][INFO    ][5147] Completed state [nslcd] at time 09:48:38.004964 (duration_in_ms=372.284)
09:48:38,005 [salt.state                                                       :1789][INFO    ][5147] Running state [/etc/nslcd.conf] at time 09:48:38.005292
09:48:38,005 [salt.state                                                       :1822][INFO    ][5147] Executing state file.managed for [/etc/nslcd.conf]
09:48:38,023 [salt.fileclient                                                  :1124][DEBUG   ][5147] In saltenv 'base', looking at rel_path 'common/files/auth/nslcd.conf' to resolve 'salt://common/files/auth/nslcd.conf'
09:48:38,024 [salt.fileclient                                                  :1132][DEBUG   ][5147] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/common/files/auth/nslcd.conf' to resolve 'salt://common/files/auth/nslcd.conf'
09:48:38,024 [salt.utils.jinja                                                 :69  ][DEBUG   ][5147] Jinja search path: [u'/var/cache/salt/minion/files/base']
09:48:38,029 [salt.transport.zeromq                                            :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:48:38,029 [salt.crypt                                                       :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:48:38,029 [salt.transport.zeromq                                            :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:48:38,030 [salt.transport.zeromq                                            :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:48:38,030 [salt.utils.templates                                             :345 ][DEBUG   ][5147] Jinja2 environment trim_blocks was set to True by jinja_env
09:48:38,030 [salt.utils.templates                                             :345 ][DEBUG   ][5147] Jinja2 environment lstrip_blocks was set to True by jinja_env
09:48:38,039 [salt.state                                                       :308 ][INFO    ][5147] File /etc/nslcd.conf is in the correct state
09:48:38,039 [salt.state                                                       :1968][INFO    ][5147] Completed state [/etc/nslcd.conf] at time 09:48:38.039289 (duration_in_ms=33.997)
09:48:38,039 [salt.state                                                       :1789][INFO    ][5147] Running state [nslcd] at time 09:48:38.039535
09:48:38,039 [salt.state                                                       :1822][INFO    ][5147] Executing state service.running for [nslcd]
09:48:38,040 [salt.loaded.int.module.cmdmod                                    :392 ][INFO    ][5147] Executing command [u'systemctl', 'status', u'nslcd.service', u'-n', u'0'] in directory '/root'
09:48:38,070 [salt.loaded.int.module.cmdmod                                    :755 ][DEBUG   ][5147] stdout: ● nslcd.service - LSB: LDAP connection daemon
   Loaded: loaded (/etc/init.d/nslcd)
   Active: active (running) since Mon 2018-10-01 11:14:56 CEST; 1 day 22h ago
   CGroup: /system.slice/nslcd.service
           └─7570 /usr/sbin/nslcd
09:48:38,100 [salt.loaded.int.module.cmdmod                                    :392 ][INFO    ][5147] Executing command [u'systemctl', 'is-active', u'nslcd.service'] in directory '/root'
09:48:38,128 [salt.loaded.int.module.cmdmod                                    :755 ][DEBUG   ][5147] stdout: active
09:48:38,129 [salt.loaded.int.module.cmdmod                                    :392 ][INFO    ][5147] Executing command [u'systemctl', 'is-enabled', u'nslcd.service'] in directory '/root'
09:48:38,156 [salt.loaded.int.module.cmdmod                                    :755 ][DEBUG   ][5147] stdout: enabled
09:48:38,156 [salt.state                                                       :308 ][INFO    ][5147] The service nslcd is already running
09:48:38,156 [salt.state                                                       :1968][INFO    ][5147] Completed state [nslcd] at time 09:48:38.156793 (duration_in_ms=117.258)
09:48:38,157 [salt.state                                                       :2768][DEBUG   ][5147] File /var/cache/salt/minion/accumulator/139738542539536 does not exist, no need to cleanup
09:48:38,158 [salt.utils.lazy                                                  :100 ][DEBUG   ][5147] LazyLoaded state.check_result
09:48:38,158 [salt.transport.zeromq                                            :128 ][DEBUG   ][5147] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506', u'aes')
09:48:38,159 [salt.crypt                                                       :463 ][DEBUG   ][5147] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf2', u'tcp://10.201.10.56:4506')
09:48:38,159 [salt.transport.zeromq                                            :194 ][DEBUG   ][5147] Connecting the Minion to the Master URI (for the return server): tcp://10.201.10.56:4506
09:48:38,160 [salt.transport.zeromq                                            :1029][DEBUG   ][5147] Trying to connect to: tcp://10.201.10.56:4506
09:48:38,170 [salt.utils.lazy                                                  :100 ][DEBUG   ][5147] LazyLoaded highstate.output
local:
----------
          ID: nsswitch_config_file
    Function: file.managed
        Name: /etc/nsswitch.conf
      Result: True
     Comment: File /etc/nsswitch.conf is in the correct state
     Started: 09:48:37.043612
    Duration: 30.685 ms
     Changes:   
----------
          ID: nslcd
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 09:48:37.632680
    Duration: 372.284 ms
     Changes:   
----------
          ID: nslcd_config_file
    Function: file.managed
        Name: /etc/nslcd.conf
      Result: True
     Comment: File /etc/nslcd.conf is in the correct state
     Started: 09:48:38.005292
    Duration: 33.997 ms
     Changes:   
----------
          ID: nslcd
    Function: service.running
      Result: True
     Comment: The service nslcd is already running
     Started: 09:48:38.039535
    Duration: 117.258 ms
     Changes:   

Summary for local
------------
Succeeded: 4
Failed:    0
------------
Total states run:     4
Total run time: 554.224 ms

real	0m47.891s
user	0m2.017s
sys	0m0.716s

I can see that 90% of the required time is about waiting for the connection to the master 4506 port... The ping to the master is not bad :

root@opendj1 [~]: ping 10.201.10.56
PING 10.201.10.56 (10.201.10.56) 56(84) bytes of data.
64 bytes from 10.201.10.56: icmp_seq=1 ttl=64 time=0.284 ms
64 bytes from 10.201.10.56: icmp_seq=2 ttl=64 time=0.087 ms
64 bytes from 10.201.10.56: icmp_seq=3 ttl=64 time=0.122 ms
64 bytes from 10.201.10.56: icmp_seq=4 ttl=64 time=0.117 ms
64 bytes from 10.201.10.56: icmp_seq=5 ttl=64 time=0.097 ms
64 bytes from 10.201.10.56: icmp_seq=6 ttl=64 time=0.093 ms
64 bytes from 10.201.10.56: icmp_seq=7 ttl=64 time=0.138 ms

A telnet o this port is instantaneous...

Any suggestion ?

cavepopo avatar Oct 03 '18 07:10 cavepopo

It looks like this may have nothing to do with the fileserver.

Can you try a couple salt-call commands that do not involve a fileclient request (e.g. salt-call test.ping -l debug or salt-call pkg.version bash -l debug), and see if you get a similar delay? If you see a similar delay, then try those same salt-call commands with -l trace and see if we get anything additional.

terminalmage avatar Oct 03 '18 13:10 terminalmage

Hi,

There is definitely not the same delays involved here, see :

root@opendj1 [~]: time salt-call pkg.version bash -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: opendj1.admin.ptf1
09:21:33,535 [salt.utils.parsers:225 ][DEBUG   ][3867] Configuration file path: /etc/salt/minion
09:21:33,536 [salt.utils.verify:524 ][WARNING ][3867] Insecure logging configuration detected! Sensitive data may be logged.
09:21:33,536 [salt.config      :1764][DEBUG   ][3867] Reading configuration from /etc/salt/minion
09:21:33,537 [salt.config      :1913][DEBUG   ][3867] Including configuration from '/etc/salt/minion.d/_schedule.conf'
09:21:33,537 [salt.config      :1764][DEBUG   ][3867] Reading configuration from /etc/salt/minion.d/_schedule.conf
09:21:33,811 [salt.loaded.int.grains.core                          :172 ][DEBUG   ][3867] The `lspci` binary is not available on the system. GPU grains will not be available.
09:21:34,050 [salt.loaded.int.grains.core                          :501 ][DEBUG   ][3867] Please install 'virt-what' to improve results of the 'virtual' grain.
09:21:34,140 [salt.minion                                          :614 ][DEBUG   ][3867] Connecting to master. Attempt 1 of 1
09:21:34,149 [salt.crypt                                           :377 ][DEBUG   ][3867] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:34,154 [salt.transport.zeromq                                :334 ][DEBUG   ][3867] Generated random reconnect delay between '1000ms' and '11000ms' (10215)
09:21:34,154 [salt.transport.zeromq                                :337 ][DEBUG   ][3867] Setting zmq_reconnect_ivl to '10215ms'
09:21:34,154 [salt.transport.zeromq                                :342 ][DEBUG   ][3867] Setting zmq_reconnect_ivl_max to '11000ms'
09:21:34,155 [salt.transport.zeromq                                :85  ][DEBUG   ][3867] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'clear')
09:21:34,168 [salt.crypt                                           :758 ][DEBUG   ][3867] Decrypting the current master AES key
09:21:34,169 [salt.crypt                                           :682 ][DEBUG   ][3867] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:34,175 [salt.utils.event                                     :311 ][DEBUG   ][3867] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_2150d1a384_pub.ipc
09:21:34,175 [salt.utils.event                                     :314 ][DEBUG   ][3867] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
09:21:34,176 [salt.transport.ipc                                   :253 ][DEBUG   ][3867] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
09:21:34,176 [salt.utils.event                                     :740 ][DEBUG   ][3867] Sending event: tag = salt/auth/creds; data = {'_stamp': '2018-10-08T07:21:34.176722', 'creds': {'publish_port': 4505, 'aes': '75+B1PxGs1vmB8fP3clmI2rUx/PtMeFEFRRikpPOgLbdhuKbEQxvHMqz1a2yWzqGIEpcXbDMl9Y=', 'master_uri': 'tcp://10.101.10.56:4506'}, 'key': ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')}
09:21:34,178 [salt.crypt                                           :682 ][DEBUG   ][3867] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:34,181 [salt.pillar                                          :47  ][DEBUG   ][3867] Determining pillar cache
09:21:34,181 [salt.transport.zeromq                                :85  ][DEBUG   ][3867] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
09:21:34,182 [salt.crypt                                           :377 ][DEBUG   ][3867] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:34,401 [salt.crypt                                           :682 ][DEBUG   ][3867] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:34,421 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded jinja.render
09:21:34,422 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded yaml.render
09:21:34,457 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded pkg.version
09:21:34,458 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded pkg_resource.version
09:21:34,459 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded cmd.run_stdout
09:21:34,460 [salt.loaded.int.module.cmdmod                        :370 ][INFO    ][3867] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}\n', '-W'] in directory '/root'
09:21:34,853 [salt.transport.zeromq                                :85  ][DEBUG   ][3867] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
09:21:34,853 [salt.crypt                                           :377 ][DEBUG   ][3867] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:34,870 [salt.utils.lazy                                      :97  ][DEBUG   ][3867] LazyLoaded nested.output
local:
    4.3-11+deb8u1

real	0m2.023s
user	0m1.094s
sys	0m0.623s

And :

root@opendj1 [~]: time salt-call test.ping -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: opendj1.admin.ptf1
09:21:42,447 [salt.utils.parsers:225 ][DEBUG   ][3917] Configuration file path: /etc/salt/minion
09:21:42,447 [salt.utils.verify:524 ][WARNING ][3917] Insecure logging configuration detected! Sensitive data may be logged.
09:21:42,447 [salt.config      :1764][DEBUG   ][3917] Reading configuration from /etc/salt/minion
09:21:42,448 [salt.config      :1913][DEBUG   ][3917] Including configuration from '/etc/salt/minion.d/_schedule.conf'
09:21:42,448 [salt.config      :1764][DEBUG   ][3917] Reading configuration from /etc/salt/minion.d/_schedule.conf
09:21:42,723 [salt.loaded.int.grains.core                          :172 ][DEBUG   ][3917] The `lspci` binary is not available on the system. GPU grains will not be available.
09:21:42,951 [salt.loaded.int.grains.core                          :501 ][DEBUG   ][3917] Please install 'virt-what' to improve results of the 'virtual' grain.
09:21:43,042 [salt.minion                                          :614 ][DEBUG   ][3917] Connecting to master. Attempt 1 of 1
09:21:43,051 [salt.crypt                                           :377 ][DEBUG   ][3917] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:43,056 [salt.transport.zeromq                                :334 ][DEBUG   ][3917] Generated random reconnect delay between '1000ms' and '11000ms' (2536)
09:21:43,057 [salt.transport.zeromq                                :337 ][DEBUG   ][3917] Setting zmq_reconnect_ivl to '2536ms'
09:21:43,057 [salt.transport.zeromq                                :342 ][DEBUG   ][3917] Setting zmq_reconnect_ivl_max to '11000ms'
09:21:43,058 [salt.transport.zeromq                                :85  ][DEBUG   ][3917] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'clear')
09:21:43,072 [salt.crypt                                           :758 ][DEBUG   ][3917] Decrypting the current master AES key
09:21:43,073 [salt.crypt                                           :682 ][DEBUG   ][3917] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:43,081 [salt.utils.event                                     :311 ][DEBUG   ][3917] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_2150d1a384_pub.ipc
09:21:43,081 [salt.utils.event                                     :314 ][DEBUG   ][3917] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
09:21:43,081 [salt.transport.ipc                                   :253 ][DEBUG   ][3917] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_2150d1a384_pull.ipc
09:21:43,082 [salt.utils.event                                     :740 ][DEBUG   ][3917] Sending event: tag = salt/auth/creds; data = {'_stamp': '2018-10-08T07:21:43.081940', 'creds': {'publish_port': 4505, 'aes': '75+B1PxGs1vmB8fP3clmI2rUx/PtMeFEFRRikpPOgLbdhuKbEQxvHMqz1a2yWzqGIEpcXbDMl9Y=', 'master_uri': 'tcp://10.101.10.56:4506'}, 'key': ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')}
09:21:43,083 [salt.crypt                                           :682 ][DEBUG   ][3917] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:43,087 [salt.pillar                                          :47  ][DEBUG   ][3917] Determining pillar cache
09:21:43,087 [salt.transport.zeromq                                :85  ][DEBUG   ][3917] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
09:21:43,087 [salt.crypt                                           :377 ][DEBUG   ][3917] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:43,300 [salt.crypt                                           :682 ][DEBUG   ][3917] Loaded minion key: /etc/salt/pki/minion/minion.pem
09:21:43,322 [salt.utils.lazy                                      :97  ][DEBUG   ][3917] LazyLoaded jinja.render
09:21:43,322 [salt.utils.lazy                                      :97  ][DEBUG   ][3917] LazyLoaded yaml.render
09:21:43,349 [salt.utils.lazy                                      :97  ][DEBUG   ][3917] LazyLoaded test.ping
09:21:43,350 [salt.transport.zeromq                                :85  ][DEBUG   ][3917] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506', 'aes')
09:21:43,350 [salt.crypt                                           :377 ][DEBUG   ][3917] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'opendj1.admin.ptf1', 'tcp://10.101.10.56:4506')
09:21:43,366 [salt.utils.lazy                                      :97  ][DEBUG   ][3917] LazyLoaded nested.output
local:
    True

real	0m1.620s
user	0m0.849s
sys	0m0.494s

cavepopo avatar Oct 08 '18 07:10 cavepopo

OK, this does seem to be specific to fileclient requests. And it doesn't seem to be a connection latency issue either, since the test.ping returned quickly.

Can you please up the verbosity in the master log? You can do this by setting log_level_logfile: debug. Then restart the salt-master service. You can then initiate your test either using salt or salt-call, it doesn't matter. I don't think that you'll get what you need logged to the console using salt -l debug, since the master's worker threads (which carry out the fileclient requests) don't log to the console. Hence the change to the log level and examining /var/cache/salt/master.

The master log file should already include timestamps, its default log format matches the one I asked you to set for the salt-call testing.

terminalmage avatar Oct 10 '18 14:10 terminalmage

Here we go : https://gist.github.com/cavepopo/49788f84223052364a22eea98a2f8f36 Thanks a lot for your time @terminalmage

cavepopo avatar Oct 15 '18 18:10 cavepopo

OK, according to the log, the job was published to the minion at 19:46:04, but the minion didn't even start running states until 19:47:05, almost exactly one minute later. Once started, they took just over 1 second to run (19:47:05.288697 to 19:47:06.426968), which suggests that fileclient requests are being fulfilled quickly and are not what is causing the delay.

Can you bump up the loglevel on the minion and repeat the same test, and then check /var/log/salt/minion to see at which time it received the job from the master?, and at which time it begins to run the states? If we compare that to the master log from the same job, then we can begin to start narrowing down where the delay occurs. Right now it's unclear whether the delay is in the minion receiving the job, or whether it occurs during the state run.

I know I had you try test.ping and a couple other examples before, but those didn't involve running states. Could you also try adding an SLS file to your gitfs server with the following contents?

successful_test:
  test.succeed_with_changes

This will use one of our test states which doesn't actually do anything (and is used simply to test the state compiler).

In the past we have had issues with certain grains causing a timeout and delaying jobs. Are you using any custom-written grains, particularly ones which make outbound network connections?

terminalmage avatar Oct 15 '18 19:10 terminalmage

Wow that's a lot of log to handle and I am not sure where to search for a job starting (either on master or minion), do you mind checking it ? Cause I really don't want to mess up the diagnosis with a wrong analysis ...

Let's first start with the very same state.apply : master log = https://gist.github.com/cavepopo/a2feff43b686a02e87e0096d0b951612 minion log = https://gist.github.com/cavepopo/c778f83eb4a867b8fc3a37d4911cba61

Now the test state you asked for : master log = https://gist.github.com/cavepopo/7c9f2b4f0c1c327734610b9a0d74478a minion log = https://gist.github.com/cavepopo/e7a9632044ca8263795b6963156050c6

Now regarding your last question : Nope, no house written grains here, I am defining custom grains for some minions but they contains only strings or int , they are totally simple and defined inside /etc/salt/grains file on minions .... there is no custom grains at all on the server on which the above tests were ran.

Hope you'll get the info you needed, thanks again for your time.

cavepopo avatar Oct 17 '18 12:10 cavepopo

OK, the delay appears to come after the minion auths to the master, but it's unclear if the auth is what is hanging. When we see delays like this, they are usually related to grains in some way. In the past we have had to remove grains that made outbound connections as any latency in connecting to those hosts will delay the job as grains are unable to finish.

If you could run a salt-call using -l trace, that will emit a separate log message at the TRACE loglevel for each grains function that is run. If we see a delay between two of these functions, that will suggest that this is related somehow to grains.

terminalmage avatar Oct 17 '18 15:10 terminalmage

Here we go (sorry for the delay) : https://gist.github.com/cavepopo/5f25a74d0b74102bc7d7bff9b669afb4

Thank you @terminalmage

cavepopo avatar Oct 19 '18 07:10 cavepopo

@cavepopo OK, it's definitely not the grains, and the trace logging shows that we did complete the auth. Given that we loaded the minion functions right after the delay ended, the next place I would like to look is when the minion requests Pillar data as it runs states. Would you be able to find salt/state.py on the minion (likely somewhere like /usr/lib/python2.7/site-packages/salt/state.py) and add in some logging before and after this block? So, this block of code would now resemble something like:

        log.debug('Gathering pillar data for state run')
        if initial_pillar and not self._pillar_override:
            self.opts['pillar'] = initial_pillar
        else:
            # Compile pillar data
            self.opts['pillar'] = self._gather_pillar()
            # Reapply overrides on top of compiled pillar
            if self._pillar_override:
                self.opts['pillar'] = salt.utils.dictupdate.merge(
                    self.opts['pillar'],
                    self._pillar_override,
                    self.opts.get('pillar_source_merging_strategy', 'smart'),
                    self.opts.get('renderer', 'yaml'),
                    self.opts.get('pillar_merge_lists', False))
        log.debug('Finished gathering pillar data for state run')

Once you do this, if you can repeat that salt-call, with debug-level logging this time, this will help tell us if the delay happens waiting for pillar data from the Master.

Thanks for continuing to bear with me as we troubleshoot, I unfortunately can't reproduce this behavior on my end.

terminalmage avatar Oct 19 '18 20:10 terminalmage

Here, the minion log (full log https://gist.github.com/cavepopo/6c9c2e67a556655a4621222bc061b64d) :

11:10:29,961 [salt.crypt                                            :463 ][DEBUG   ][29061] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'opendj1.admin.ptf1', u'tcp://10.101.10.56:4506')
11:10:29,962 [salt.transport.zeromq                                 :194 ][DEBUG   ][29061] Connecting the Minion to the Master URI (for the return server): tcp://10.101.10.56:4506
11:10:29,966 [salt.transport.zeromq                                 :1029][DEBUG   ][29061] Trying to connect to: tcp://10.101.10.56:4506
11:10:29,966 [salt.transport.zeromq                                 :35  ][TRACE   ][29061] Inserted key into loop_instance_map id 139939152412824 for key (u'/etc/salt/pki/minion', u'opendj1.admin.ptf1', u'tcp://10.101.10.56:4506', u'aes') and process 29061
11:11:31,257 [salt.state                                            :724 ][DEBUG   ][29061] Gathering pillar data for state run
11:11:31,257 [salt.state                                            :738 ][DEBUG   ][29061] Finished gathering pillar data for state run
11:11:31,257 [salt.state                                            :925 ][INFO    ][29061] Loading fresh modules for state activity
11:11:31,288 [salt.utils.lazy                                       :100 ][DEBUG   ][29061] LazyLoaded jinja.render
11:11:31,289 [salt.utils.lazy                                       :100 ][DEBUG   ][29061] LazyLoaded yaml.render

Comparing this one to its master counterpart shows that the whole minute delay (bw 11:10:29 and 11:10:31) is spent running gitfs related operation, mostly :

2018-10-20 11:10:29,968 [salt.utils.gitfs :2664][DEBUG   ][10777] Created gitfs object with uninitialized remotes
2018-10-20 11:10:29,968 [salt.utils.lazy  :100 ][DEBUG   ][10777] LazyLoaded gitfs.envs
2018-10-20 11:10:29,970 [salt.utils.gitfs :679 ][DEBUG   ][10777] Current fetch URL for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': ssh://[email protected]/Ops/salt-eloquant.git (desired: ssh://[email protected]/Ops/salt-eloquant.git)
2018-10-20 11:10:29,970 [salt.utils.gitfs :701 ][DEBUG   ][10777] Current refspecs for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'] (desired: [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'])
2018-10-20 11:10:29,970 [salt.utils.gitfs :722 ][DEBUG   ][10777] Current http.sslVerify for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': true (desired: true)
2018-10-20 11:10:29,971 [salt.utils.gitfs :679 ][DEBUG   ][10777] Current fetch URL for gitfs remote 'ssh://[email protected]/Ops/salt-unit_tests.git': ssh://[email protected]/Ops/salt-unit_tests.git (desired: ssh://[email protected]/Ops/salt-unit_tests.git)
2018-10-20 11:10:29,971 [salt.utils.gitfs :701 ][DEBUG   ][10777] Current refspecs for gitfs remote 'ssh://[email protected]/Ops/salt-unit_tests.git': [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'] (desired: [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'])
2018-10-20 11:10:29,971 [salt.utils.gitfs :722 ][DEBUG   ][10777] Current http.sslVerify for gitfs remote 'ssh://[email protected]/Ops/salt-unit_tests.git': true (desired: true)
2018-10-20 11:10:29,971 [salt.utils.gitfs :2666][DEBUG   ][10777] Created gitfs object for process 10777
2018-10-20 11:10:29,977 [salt.utils.lazy  :100 ][DEBUG   ][10774] LazyLoaded roots.envs
2018-10-20 11:10:29,977 [salt.utils.gitfs :2664][DEBUG   ][10774] Created gitfs object with uninitialized remotes
2018-10-20 11:10:29,977 [salt.utils.lazy  :100 ][DEBUG   ][10774] LazyLoaded gitfs.envs
2018-10-20 11:10:29,982 [salt.utils.gitfs :679 ][DEBUG   ][10774] Current fetch URL for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': ssh://[email protected]/Ops/salt-eloquant.git (desired: ssh://[email protected]/Ops/salt-eloquant.git)
2018-10-20 11:10:29,982 [salt.utils.gitfs :701 ][DEBUG   ][10774] Current refspecs for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'] (desired: [u'+refs/heads/*:refs/remotes/origin/*', u'+refs/tags/*:refs/tags/*'])
2018-10-20 11:10:29,982 [salt.utils.gitfs :722 ][DEBUG   ][10774] Current http.sslVerify for gitfs remote 'ssh://[email protected]/Ops/salt-eloquant.git': true (desired: true)
2018-10-20 11:10:29,983 [salt.utils.gitfs :679 ][DEBUG   ][10774] Current fetch URL for gitfs remote 'ssh://[email protected]/Ops/salt-unit_tests.git': ssh://[email protected]/Ops/salt-unit_tests.git (desired: ssh://[email protected]/Ops/salt-unit_tests.git)

cavepopo avatar Oct 20 '18 09:10 cavepopo

The master stuff is just the update thread fetching, that has nothing to do with pillar. What that debug logging shows though is that the pillar compilation inside the state run is not what is causing the delay, since it happens after the delay.

OK, more debug logging (you can remove the stuff from salt/state.py if you like). What I need you to do is add some sort of logging message both before and after this line in salt/cli/caller.py and repeat your salt-call.

terminalmage avatar Oct 20 '18 13:10 terminalmage