Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#57598 - varnish unit file should use type=forking
Attached to Project:
Arch Linux
Opened by guillaume quintard (gquintard) - Wednesday, 21 February 2018, 13:57 GMT
Last edited by Dave Reisner (falconindy) - Friday, 02 March 2018, 16:19 GMT
Opened by guillaume quintard (gquintard) - Wednesday, 21 February 2018, 13:57 GMT
Last edited by Dave Reisner (falconindy) - Friday, 02 March 2018, 16:19 GMT
|
DetailsDescription:
/usr/lib/systemd/system/varnish.service starts varnishd with -F, meaning that the user don't get any feedback in case the configuration is wrong and varnishd fails to start. |
This task depends upon
Closed by Dave Reisner (falconindy)
Friday, 02 March 2018, 16:19 GMT
Reason for closing: Fixed
Additional comments about closing: Service uses Type=forking in varnish-5.2.1-2
Friday, 02 March 2018, 16:19 GMT
Reason for closing: Fixed
Additional comments about closing: Service uses Type=forking in varnish-5.2.1-2
Why this is not a bug? I don't think varnish use a systemd activation logic so foreground may not be the suitable option here.
systemd needs to know when a daemon has been started for ordering, so a correct way of knowing that is important.
The feedback from systemctl is not the real topic here, but we can expect one because it has been conceived that way. As you may know «systemctl start» wait the service to be started before returning and let's people know about errors. Why is this very² wrong?
@Guillaume, do you know why varnish doesn't fail (return !=0) when started with a wrong configuration file in foreground mode?
As varnish is providing services on the network, without sd_notify and if they respect systemd recommendation on the forking code, type=forking may be the appropriate solution.
Like we do with nginx...
Ironically, my main argument here is that with "type=simple" running "systemctl start varnish" will return 0 no matter what. You need to run "systemctl status" afterwards to check.
Using "type=forking" would allow systemd to bubble the failure up during the start operation.
I hadn't even considered that you would want "systemctl start varnish" to exit 0 after a failure. I still can't fathom it. ;-)
What. systemctl is a command that manages systemd units in the systemd service hierarchy. It returns success when it correctly communicates the start command to the service manager -- if you want to know about internal service manager states in a script, you'll need to query the service manager...
systemctl show varnish.service -q -p ActiveState
will return after a failure,
ActiveState=failed
If the service manager itself is having issues with type=simple, please explain what those issues are, and if not, file an upstream bugreport with systemd and watch them not care.
> "Type=simple services are really easy to write, but have the major disadvantage of systemd not being able to tell when initialization of the given service is complete."
That seems like a pretty big step back to me, specially when we have the option to avoid it.
varnishd supports forking and systemd has Type=forking ("Many traditional daemons/services background (i.e. fork, daemonize) themselves when starting. Set Type=forking in the service's unit file to support this mode of operation."), that's not a fringe option or a hack, that's the a perfectly valid, common option.
I do get the KISS mindset, but here, refusing to use the provided and supported feature leads to more cumbersome code: if you have a service needing varnish to be started Type=forking will block until the fork happens, with Type=simple you have to reinvent the wheel and provide your own waiting loop, for every single service depending on varnishd.
"
I would like to report a bug. The varnish package installs a downstream Arch Linux-specific systemd unit file (since upstream did not provide one), which uses Type=simple. This is wrong and it should use Type=forking in order to ensure that the service is blocked until varnish has properly started, thereby allowing proper systemd service dependency ordering.
An alternative would be to use Type=notify or Type=dbus, but these won't work as varnish does not actually implement such an interface.
Currently it is impossible for a service to specify
Requires=varnish.service
After=varnish.service
and actually know with any degree of confidence that varnish is truly available.
"
I have no idea where "meaning that the user don't get any feedback in case the configuration is wrong and varnishd fails to start" came from, nor why "Ironically, my main argument here is that with "type=simple" running "systemctl start varnish" will return 0 no matter what. You need to run "systemctl status" afterwards to check." matters, if the issue is entirely related to blocking the service manager state.