Skip to content

[BUG] Salt execution sometimes failes with exception with KeyError: 'retcode' error #61079

Closed

Description

@Oloremo

Description

Issue #56273 is still present in 3003.2, but manifests itself only during the high CPU load\CPU resource starvation.

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'retcode'
Traceback (most recent call last):
  File "/opt/behavox/salt/venv/bin/salt", line 11, in <module>
    load_entry_point('salt==3003.2', 'console_scripts', 'salt')()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/scripts.py", line 539, in salt_main
    client.run()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/salt.py", line 108, in run
    self._run_batch()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/salt.py", line 299, in _run_batch
    for res in batch.run():
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/batch.py", line 291, in run
    if self.opts.get("failhard") and data["retcode"] > 0:
KeyError: 'retcode'
Traceback (most recent call last):
  File "/opt/behavox/salt/venv/bin/salt", line 11, in <module>
    load_entry_point('salt==3003.2', 'console_scripts', 'salt')()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/scripts.py", line 539, in salt_main
    client.run()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/salt.py", line 108, in run
    self._run_batch()
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/salt.py", line 299, in _run_batch
    for res in batch.run():
  File "/opt/behavox/salt/venv/lib64/python3.6/site-packages/salt/cli/batch.py", line 291, in run
    if self.opts.get("failhard") and data["retcode"] > 0:
KeyError: 'retcode'

Setup

  • VM running on a cloud service, please be explicit and add details

AWS EC2 m5.2xlarge instance.

Steps to Reproduce the behavior
We were able to reproduce it on 173 nodes cluster using just a

salt \* saltutil.refresh_pillar wait=true

with batch size of 50 (triggered via batch_safe_size param)

Expected behavior
The execution would finish or time out.

Additional context
We don't have enough CPU resources on that node to run Salt properly. We set worker_threads: 6 but sometimes we don't have 6 CPUs ready to serve salt requests - they could be consumed by other things on the cluster.

And seems like it's a deciding factor for triggering that issue. (not 100% sure)

CleanShot 2021-10-19 at 19 40 50

  1. execution start
  2. execution failed

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3003.2

Dependency Versions:
          cffi: 1.14.5
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.3
       libgit2: Not Installed
      M2Crypto: 0.37.1
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: 2.6.1
  pycryptodome: 3.10.1
        pygit2: Not Installed
        Python: 3.6.8 (default, Aug  7 2019, 17:28:10)
  python-gnupg: 0.4.5
        PyYAML: 5.4.1
         PyZMQ: 19.0.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.2

System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1062.4.3.el7.x86_64
        system: Linux
       version: CentOS Linux 7 Core```
</details>

Activity

  1. added
    bug
    on Oct 19, 2021
  2. changed the title [-][BUG][/-] [+][BUG] Salt execution sometimes failes with exception with KeyError: 'retcode' error[/+] on Oct 19, 2021
  3. Oloremo commented on Oct 20, 2021

    @Oloremo
    ContributorAuthor

    I'm aware it would be very hard to reproduce but I can reproduce it very easily on that env, so I'm happy to apply any patches or do any other debug to help with that issue.

  4. frogunder commented on Oct 21, 2021

    @frogunder
    Contributor

    @dwoz maybe you can take a look at this since it might be related to #56273

    or @saltstack/team-core ?

  5. Oloremo commented on Oct 21, 2021

    @Oloremo
    ContributorAuthor

    It's related. The same issue, the original fix seems like only reduced the race window.

  6. added
    Core
    severity-medium
    and removed on Oct 26, 2021
  7. added this to the Approved milestone on Oct 26, 2021
  8. dmurphy18 commented on Jul 11, 2023

    @dmurphy18
    Contributor

    Closing this since Salt 3003.2 which is EOL. If reoccurs, should reopen against latest which is 3006.1 using onedir packaging

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

Metadata

Metadata

Assignees

Labels

Corebugseverity-medium

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions