Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] salt-master wastes time writing event data to standard out when executing runner functions through the api #58203

Open
mbirtwell opened this issue Aug 14, 2020 · 5 comments · May be fixed by #66134
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@mbirtwell
Copy link
Contributor

Description
I was doing some profiling to try and understand why some of my salt api requests were so slow and I noticed that the salt-master spends some considerable time in display_output printing data to standard out, which for me is /dev/null.

I've worked around this by setting quiet: True in my salt master configuration. But this doesn't seem to be documented anywhere.

In addition I notice that when the RunnerClient is constructed in salt.master.Maintenance._post_fork_init quiet is forced to True, but when the runner client used by the api is constructed in salt.master.ClearFuncs.runner it isn't. I wonder if it should be.

Versions Report

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

Dependency Versions:
           cffi: 1.11.5
       cherrypy: unknown
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.9
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: Not Installed
   pycryptodome: 3.9.8
         pygit2: Not Installed
         Python: 3.6.8 (default, Mar 21 2019, 10:08:12)
   python-gnupg: Not Installed
         PyYAML: 5.1
          PyZMQ: 17.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.6

System Versions:
           dist: fedora 28 Twenty Eight
         locale: utf-8
        machine: x86_64
        release: 4.7.10
         system: Linux
        version: Fedora 28 Twenty Eight
@mbirtwell mbirtwell added the Bug broken, incorrect, or confusing behavior label Aug 14, 2020
@mbirtwell
Copy link
Contributor Author

It transpires my work around of setting quiet: True in the salt-master config was a bad idea, because it caused salt-run to not produce any output. So I'll likely produce a PR for setting quiet on the opts passed to RunnerClient in salt.master.ClearFuncs.runner with in a day or two.

@marbx
Copy link
Contributor

marbx commented Aug 24, 2020

@mbirtwell,
I would like to collect examples and encourage profiling.
Could you please describe how you profiled and what you found?

@mbirtwell
Copy link
Contributor Author

This tar ball has the patch I was using to generate profiles and a profile with and without my proposed fix.
salt_low_list_job_profiling.tar.gz

Head lines:
I was timing/profiling the whole of the salt.client.mixins.SyncClientMixin.low function. Without my change to list a particular highstate it took ~4.6s with my change it took ~1.8s.

@sagetherage sagetherage added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around and removed needs-triage labels Sep 23, 2020
@sagetherage sagetherage added this to the Approved milestone Sep 23, 2020
@nicholasmhughes
Copy link
Collaborator

Jumping on this issue as it's the only one left open which references the undocumented quiet configuration parameter. Previous issues which reference it are #21392 and #28354 .

My use case is using the publish.runner execution module from the minion to execute a runner on the master. The nested output you'd expect from stdout during that runner execution is showing up in journalctl. If that runner returns sensitive data, that's obviously not ideal.

So, I found the quiet: true master configuration parameter after digging around in the code. Now I'm wondering what the best way forward is...

At the very least, we should document the current usage of quiet. Alternatively, we could change the name to something more descriptive (like @cro tried in #31571) and document that.

Thoughts on a way forward? @whytewolf @barbaricyawps

@whytewolf
Copy link
Contributor

MY thoughts are it should be documented in the python api. as tha is where it is most useful. setting it in the actual config can be bad as pointed out in this ticket.

that being said all of these side cases that are not setting it when they should be such as salt-api, saltutil.runner, publisher.runner. should be updated to set it.

the code in the pr linked here was valid. and one of the pieces that needed shoring up. just needed testing. so if you want to go that route i would be open to it.

@nesle nesle linked a pull request Feb 23, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
6 participants