[systemd-devel] Boot ordering

Reindl Harald h.reindl at thelounge.net
Fri Mar 20 13:23:09 PDT 2015

Am 20.03.2015 um 21:10 schrieb Kai Krakow:
>>> i guess that's whay mysqld needs
>>> "ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID" having a shell
>>> script waitig in a lopp until connections are accepted to prevent
>>> services with "After=mysqld"
> I think MySQL is broken in this regard as it signals the caller to be ready
> before actually being ready. I think I've read this is a known problem and
> that there are plans to support socket activation/socket passing in the
> future.

no - you refuse to understand that "Type=simple" (which is forground) 
just starts the binary and since there is no forking there is no 
knowledge when it is ready or that it can be ready for whatever

it is just a process running and that's it

>>> with foreground you have *no control at all* becasue systemd fires up the
>>> next service immediately, frankly systemd even don't know the startup
>>> time of "Type=simple" services, hence they are missing in "systemd-anlyze
>>> blame"
>> Right,  if a service needs to setup communication channels etc. for
>> other services to talk to, then imho simple is not the best choice as
>> you need to resort to hacks like you describe.
>> Ideally, mysql would use sd_notify, Type=forking is probably the next
>> best.
> Ooops, yes Michael, you are perfectly right. If the process is forking, it
> will (at least should) return only when it is ready and then it makes
> perfect sense. This would not be possible with non-forking processes and
> those would need to resort to socket passing to actually "be ready" the very
> moment when started.

well, you where the one which said "start processes in foreground is the 
sultion and recommended"

> But for MySQL: It think it is simply not ready yet when returning to the
> caller - probably that's because the service spawner "mysqld_safe" is a
> script which also tries to handle the PID file etc etc

nobody talks about "mysqld_safe", nobody needs it because the only 
purpose is to restart mysqld if it fails - that systemd also can, will 
and does - no mysqld_safe here, our private builds even remove it from 
the package

the point is just that a non-forking process without socket activation 
has no change to state anything and socket activation has it's other 
drawbacks like "if i say sysetmctl stop i mean systemctl stop and not 
fire the service up again if a packet arrives on the socket"

PLEASE stop to hang on mysqld, i just explained why staring a service in 
foreground don't help in any case, the opposite is true, hence i changed 
the clamd-service which is default forground started to forking to order 
clamav-milter correctly (just another *example*)

it's not that easy and the world is not and won't be perfect

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150320/fed8a6f0/attachment.sig>

More information about the systemd-devel mailing list