salt icon indicating copy to clipboard operation
salt copied to clipboard

service.start salt-minion hangs from console on CentOS

Open dlindquist opened this issue 13 years ago • 36 comments

Per salt/utils/init.py:

175     # A normal daemonization redirects the process output to /dev/null. 
176     # Unfortunately when a python multiprocess is called the output is 
177     # not cleanly redirected and the parent process dies when the 
178     # multiprocessing process attempts to access stdout or err. 
179     #dev_null = open('/dev/null', 'rw') 
180     #os.dup2(dev_null.fileno(), sys.stdin.fileno()) 
181     #os.dup2(dev_null.fileno(), sys.stdout.fileno()) 
182     #os.dup2(dev_null.fileno(), sys.stderr.fileno()) 

This causes service.start to hang if executed from the console:

# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m

# salt-call service.start salt-minion
[INFO    ] Loaded configuration file: /etc/salt/minion
[INFO    ] Executing command '/sbin/service salt-minion start' in directory '/root'
(hangs here)

I see two ways to potential fix this:

  1. Close the inherited file handles in the python code
  2. Change the init scripts, redirecting the start of the daemon to /dev/null. I've verified that this is a workaround.

dlindquist avatar Apr 06 '13 09:04 dlindquist

I think that the reason why we had to comment out those lines has been solved, I am going to reopen this issue to take a look at those line comments to see if they can be uncommented

thatch45 avatar Apr 08 '13 18:04 thatch45

Nope, my workaround did nto work, closing

thatch45 avatar Apr 27 '13 16:04 thatch45

Dumb question, why is this closed? I am running 0.16.0 on RedHat and Centos-- and have this issue..

caseybea avatar Aug 19 '13 18:08 caseybea

Looks like it was closed because that commit fixed it. Or didn't, as the case may be. Can you test on 0.16.3 or the git develop branch just to make sure it has not been fixed? Then I'll re-open the issue.

basepi avatar Aug 20 '13 23:08 basepi

Hi there... I still have this issue with Centos 64 and salt 0.16.3.

First noticed the issue when using salty-vagrant, 'vagrant up' get stuck after printing 'Calling state.highstate... (this may take a while)', but a 'salt-call state.highstate -l debug' also hangs after "[INFO ] Executing command '/sbin/service start' in directory '/root' "

fabiowg avatar Aug 23 '13 13:08 fabiowg

Reopened. Thanks for the updates.

basepi avatar Aug 23 '13 18:08 basepi

This issue affects me for Redhat5, Redhat6, Centos6. (I don't have centos 5 in house).

Interestingly enough, this issue manifested itself to me in a slightly different manner. I was dealing with an issue about minions no longer talking to the master (different bug)... and to fix it I figured, "easy- I'll just write a ssh script to connect to my servers (key access), and restart the minions!".

So, when I do:

(from a host that has ssh-key access to a minion):

ssh minion-name.domain "service salt-minion stop" <--- this works fine ssh minion-name.domain "service salt-minion start" <--- this starts the minion, and then HANGS

But logging in directly to a minion, and manually doing the same command to stop and start-- fine.

So yes, I agree there's something funky about the input or output device during the start process.

PS: Same behavior if I replace "service salt-minion start" with "/etc/init.d/salt-minion start".

caseybea avatar Aug 23 '13 19:08 caseybea

I think that this can be fixed with some of the new cmd module routines

thatch45 avatar Oct 17 '13 19:10 thatch45

As a relatively new SALT user, can you please elaborate? Example command? Which version(s) have the new command module routines?

caseybea avatar Oct 17 '13 19:10 caseybea

As far as I was aware, this was fixed as per my pull request in https://github.com/saltstack/salt/pull/5576 riased on #5567 - is this not the case?

foxx avatar Oct 17 '13 19:10 foxx

I have no idea. In what version of salt is this supposed to be fixed in?

caseybea avatar Oct 17 '13 19:10 caseybea

@caseybea I'm not sure, it was merged into develop on https://github.com/saltstack/salt/commit/a7f2d4df270f6f11e804383ffbcfcb9f3eecba03 and tagged as v0.17.1 . Latest develop shows 'with_communicate' inside the file, as does 0.17 - so I think this (and all other related tickets) can be marked as resolved?

foxx avatar Oct 17 '13 20:10 foxx

@caseybea try updating to 0.17 and see if the issue is fixed. As far as I know, this can be closed.

foxx avatar Oct 17 '13 20:10 foxx

The latest version of salt in the salt repositories is: 0.16.4-1

When will 0.17 actually make it to the redhat/centos salt-published repos?

caseybea avatar Oct 17 '13 20:10 caseybea

@terminalmage is building rpms RIGHT NOW

thatch45 avatar Oct 17 '13 20:10 thatch45

EPEL RPMs for 0.17.1 are already completed and pending acceptance into epel-testing.

https://koji.fedoraproject.org/koji/buildinfo?buildID=472098 https://koji.fedoraproject.org/koji/buildinfo?buildID=472111

terminalmage avatar Oct 17 '13 21:10 terminalmage

Unfortenately, this doesn't look fixed.

Tested on two RHEL6 minions running 0.17.1.

Still hangs when at "Starting salt-minion daemon: [ OK ]"

I discussed this issue on the list: https://groups.google.com/forum/#!topic/salt-users/Q6_aRjlpnYM

@caseybea : can you confirm on your side ?

sebw avatar Oct 22 '13 13:10 sebw

Confirmed: STILL HANGS when starting remotely via ssh.

Salt version: 0.17.1-1.el6 from the epel-testing repos.

caseybea avatar Oct 22 '13 13:10 caseybea

Oh wait, this is not the same issue as #5567.

The problem in #5567 was that cmdmod was hanging on execution due to improper stdio handling by the executed binary.

The problem here is that salt-minion is causing service daemon to hang, properly either due to a misconfiguration of the service config, or a problem with stdio handling within salt-minion.

Apologies for not spotting this before guys, my bad.

foxx avatar Oct 22 '13 14:10 foxx

Reopening. Thanks for the input.

basepi avatar Oct 22 '13 19:10 basepi