Skip to content

[BUG] State cmd.script with parallel set to true hangs in 3006.5 #65709

@johje349

Description

@johje349

Description
After upgrading from 3006.3 to 3006.5 we started seeing hanging minion processes consuming 100% CPU.
Narrowed it down to salt.script states with parallel: True.

Setup
SLS:

test:
  cmd.script:
    - source: salt://scripts/test.sh
    - name: test.sh 
    - shell: /bin/bash
    - parallel: True

Script:

#!/bin/bash

echo "test"

exit 0

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
salt 'asx-test' state.apply test

Relevant minion log on asx-test:

2023-12-15 15:57:17,948 [salt.fileclient  :1363][INFO    ][270247] Fetching file from saltenv 'base', ** done ** 'test/init.sls'
2023-12-15 15:57:17,948 [salt.template    :53  ][DEBUG   ][270247] compile template: /var/cache/salt/minion/files/base/test/init.sls
2023-12-15 15:57:17,949 [salt.utils.jinja :79  ][DEBUG   ][270247] Jinja search path: ['/var/cache/salt/minion/files/base']
2023-12-15 15:57:17,952 [salt.template    :23  ][PROFILE ][270247] Time (in seconds) to render '/var/cache/salt/minion/files/base/test/init.sls' using 'jinja' renderer: 0.003893613815307617
2023-12-15 15:57:17,953 [salt.template    :116 ][DEBUG   ][270247] Rendered data from file: /var/cache/salt/minion/files/base/test/init.sls:
test:
  cmd.script:
    - source: salt://scripts/test.sh
    - name: test.sh 
    - shell: /bin/bash
    - parallel: True

2023-12-15 15:57:17,954 [salt.template    :23  ][PROFILE ][270247] Time (in seconds) to render '/var/cache/salt/minion/files/base/test/init.sls' using 'yaml' renderer: 0.0012822151184082031
2023-12-15 15:57:17,955 [salt.loader.lazy :977 ][DEBUG   ][270247] The functions from module 'config' are being loaded by dir() on the loaded module
2023-12-15 15:57:17,955 [salt.utils.lazy  :99  ][DEBUG   ][270247] LazyLoaded config.option
2023-12-15 15:57:17,956 [salt.loader.lazy :977 ][DEBUG   ][270247] The functions from module 'cmd' are being loaded by dir() on the loaded module
2023-12-15 15:57:17,956 [salt.utils.lazy  :99  ][DEBUG   ][270247] LazyLoaded cmd.script
2023-12-15 15:57:17,956 [salt.state       :2295][INFO    ][270247] Running state [test.sh] at time 15:57:17.956921
2023-12-15 15:57:17,957 [salt.state       :2326][INFO    ][270247] Executing state cmd.script for [test.sh]
2023-12-15 15:57:17,961 [salt.state       :321 ][INFO    ][270247] Started in a separate process
2023-12-15 15:57:17,962 [salt.state       :2493][INFO    ][270247] Completed state [test.sh] at time 15:57:17.962736 (duration_in_ms=5.81)
2023-12-15 15:57:17,968 [salt.loaded.int.log_handlers.fluent_mod:32  ][TRACE   ][270261] The required configuration section, 'fluent_handler', was not found the in the configuration. Not loading the fluent logging handlers module.
2023-12-15 15:57:17,971 [salt.loaded.int.log_handlers.logstash_mod:32  ][TRACE   ][270261] None of the required configuration sections, 'logstash_udp_handler' and 'logstash_zmq_handler', were found in the configuration. Not loading the Logstash logging handlers module.
2023-12-15 15:57:17,972 [salt.loader.lazy :32  ][TRACE   ][270261] Error loading log_handlers.sentry_mod: Cannot find 'raven' python library, 'sentry_handler' config is empty or not defined
2023-12-15 15:57:17,975 [salt.loader.lazy :32  ][TRACE   ][270261] Loaded cmdmod as virtual cmd
2023-12-15 15:57:17,976 [salt.loader.lazy :977 ][DEBUG   ][270261] The functions from module 'cmd' are being loaded by dir() on the loaded module
2023-12-15 15:57:17,976 [salt.utils.lazy  :99  ][DEBUG   ][270261] LazyLoaded cmd.script
2023-12-15 15:57:17,977 [salt.loader.lazy :977 ][DEBUG   ][270261] The functions from module 'cp' are being loaded by dir() on the loaded module
2023-12-15 15:57:17,978 [salt.utils.lazy  :99  ][DEBUG   ][270261] LazyLoaded cp.cache_file
2023-12-15 15:57:17,979 [salt.channel.client:32  ][TRACE   ][270261] ReqChannel send crypt load={'path': 'scripts/test.sh', 'saltenv': 'base', 'cmd': '_file_hash'}

Silent for process 270261 after that.

top output for process 270261:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                   
270261 root      20   0  627832  58188   6368 S 100.0   0.0   4:29.45 /opt/saltstack/ 

root 270261 270247 99 15:57 ? 00:05:22 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20231215145716488579) Minion._thread_return ParallelState(test.sh)

Expected behavior
Expect state.apply to return

Versions Report

Salt Version:
          Salt: 3006.5
 
Python Version:
        Python: 3.10.13 (main, Nov 15 2023, 04:34:27) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.14.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 16.04.3 jammy
        locale: utf-8
       machine: x86_64
       release: 5.15.0-88-generic
        system: Linux
       version: Ubuntu 16.04.3 jammy

Metadata

Metadata

Assignees

Labels

bugbroken, incorrect, or confusing behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions