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
[systemd] saltstack (git master version) can't start with systemd 216 #15721
Comments
@gtmanfred as requested |
@terminalmage can you take a look at this too since we worked on this part of the systemd stuff |
@thatch45 @SmithSamuelM can yall or someone else verify for me where in the code the __bind for zmq and raet are done? If we move the systemd.daemon.notify('READY=1') to here https://github.com/saltstack/salt/blob/develop/salt/__init__.py#L124 would the zmq socket be done __bind ing? since it is after the daemonize_if_required function?
Thanks |
Thanks for the report @aboe76! Looks like @gtmanfred already has some ideas. The |
It does not. The problem is that the master process that runs the __bind, is not the main master process, which is why the systemd.daemon.notify is complaining. My change would move the notify to after the __bind is run, but the parent master process is the one that runs it, but i don't know if it is going to be run at a point that actually is after all of the sockets are done with __bind and the master process is completly started. |
@gtmanfred isn't it possible to find out what the parent master process pid is and just add it to the systemd.daemon.notify ? I think python is smart enough to find out what it parent pid is... |
python-systemd does not support sending the MAINPID from what I can see. It would need to have notifyf wrapped. Even if it did work, there is another process between the __bind() and the MAINPID, in my trying they getppid() at that place and the was not the same pid that was placed in set_pidfile. |
@gtmanfred, thanks for trying, so if only the MAINPID process can do systemd.daemon.notify, than there needs to be some logic change to have all other processes report back to the MAINPID process before it sends the systemd.daemon.notify, but that sound like something stable... |
I would rather pull this out before we cut the release then deal with it, also, that should be the main process, but has it been daemonized? |
it appears that the point where it does the __bind is no longer the main pid. |
hi @gtmanfred, thanks for the fix, the salt-master starts with systemd notify, but it still logs this:
if I look closer:
but it starts without and a minion can connect to it. |
If I start salt-master with systemctl start salt-master it will hang for a long time.
This is the output of journalctl -u salt-master -l
If I'm correct this means that systemd notify expects that only the mainpid will be the one that sends the notify, not all the forked processes.
this is from the following patch:
systemd/systemd@336c6e4
So it looks like salt needs to send the mainpid with the notifies.
I think this line: systemd.daemon.notify('READY=1')
here: https://github.com/saltstack/salt/blob/develop/salt/master.py#L471
needs to change to something (sorry not good with pythoncode myself)
systemd.daemon.notify('READY=1','MAINPID=(some pythoncode that prints the mainpid of its process)')
The text was updated successfully, but these errors were encountered: