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

config-reloader exits prematurely due to errexit #268

Closed
mrichar1 opened this issue Oct 23, 2024 · 1 comment · Fixed by #270
Closed

config-reloader exits prematurely due to errexit #268

mrichar1 opened this issue Oct 23, 2024 · 1 comment · Fixed by #270
Assignees
Labels
bug Something isn't working

Comments

@mrichar1
Copy link
Contributor

Describe the bug
config-loader sources /etc/docker-salt/runtime/functions.sh which calls set -o errexit which will cause the script to exit on any command failure.

It then later runs killall salt-master; killall -9 salt-master

If these commands return non-zero exit (failing to kill processes), the whole script exits and the subsequent daemon restart commands are never called, leaving the daemons stopped.

Looking at the process tree it appears that the salt-master processes are actually of the form:

/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master

This means that killall will always fail as it matches process, not arguments.

To match arguments, avoid premature exit, and also catch any runaway api processes, this might be a good alternative:

pkill -f "salt-(master|api)" || true
pkill -f -9 "salt-(master|api)" || true

Happy to generate a PR if this solution suits, or you have a different one in mind?

@mrichar1 mrichar1 added the bug Something isn't working label Oct 23, 2024
@cdalvaro
Copy link
Owner

Hi @mrichar1 thank you very much for opening this issue.

I'll be pleased if you generate a PR to fix the issue, but I know you're working on fixing another bug. So if you don't have time, I'll try to fix this one asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants