Commit graph

9 commits

Author SHA1 Message Date
Michael Biebl
e3b21780b6 dispatcher: show man page in .service file
We have a nice man page so let's advertise it a bit by hooking it up in
NetworkManager-dispatcher.service.
2023-11-03 07:19:08 +00:00
Thomas Haller
d25a33f604
dispatcher: support enabling debug logging via environment variable
The advantage of environment variables is that the user can use
`systemctl edit NetworkManager-dispatcher.service` for setting them,
without need to change the ExecStart= line.

Also, enabling debugging from the start is useful, despite that debug
logging can be enabled per-request.

Also, there is a difference whether we want verbose logging or whether
we want to log to stdout. There should be a flag, that only increases the
logging verbosity, but does not change the logging backend.
2021-08-04 09:41:11 +02:00
Thomas Haller
4fe20e4cbe
dispatcher: fix race for exit-on-idle
- exit-on-idle needs to be done correctly. Fix the race, by first
  notifying systemd (STOPPING=1), releasing the name, and all the
  while continue processing requests.

- don't use g_bus_own_name_on_connection(). That one also listens
  to NameLost and NameAcquired signals, but we don't care about those.
  systemd will take care to only spawn one process at a time. And
  anyway, the well-known name is only important to be reachable, we
  don't require it to be functional. We can get the first request
  before RequestName completed and we can continue getting requests
  after releasing the name.
2021-08-04 09:41:10 +02:00
Beniamino Galvani
105abf27c1 Revert "dispatcher/systemd: order NetworkManager-dispatcher.service Before=NetworkManager.service"
The 'Before' dependency between NM-dispatcher and NM causes a deadlock
when stopping the NM service. When terminating, NM wants to D-Bus
activate NM-dispatcher to synchronously handle pre-down events; but
NM-dispatcher start is ordered after NM shutdown due to the following
behavior described in systemd.unit(5) man page:

  Given two units with any ordering dependency between them, if one
  unit is shut down and the other is started up, the shutdown is
  ordered before the start-up. It doesn't matter if the ordering
  dependency is After= or Before=, in this case. It also doesn't
  matter which of the two is shut down, as long as one is shut down
  and the other is started up; the shutdown is ordered before the
  start-up in all cases.

So, NM is waiting NM-dispatcher to start and NM-dispatcher is queued
by systemd, waiting that NM is stopped. The result is a 90 seconds
delay, after which systemd kills NM and continues.

The dependency was added so that during shutdown NM-dispatcher would
be stopped after NM. I don't think it worked as expected because
NM-dispatcher is not supposed to be active most of the times, and so
it doesn't need a dependency that delays its stop after NM.

This reverts commit acc335aad4.
2020-03-02 17:47:29 +01:00
Thomas Haller
acc335aad4 dispatcher/systemd: order NetworkManager-dispatcher.service Before=NetworkManager.service
During shutdown, systemd should first stop NetworkManager and then
the dispatcher service. Note that dispatcher service is D-Bus activated,
so the two services don't Want/Require each other. But the ordering
still matters.
2019-05-27 12:43:06 +02:00
Dan Williams
4cc13befd3 dispatcher: rename executable to 'nm-dispatcher' 2014-06-06 13:43:45 -05:00
Dan Winship
d53357f420 dispatcher: tell systemd to not kill dispatcher children
You're supposed to be able to use dispatcher scripts to spawn
long-running processes, but currently systemd will kill them when
nm-dispatcher exits. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=725492
2014-04-18 11:32:12 -04:00
Dan Williams
75c64763f6 systemd: fix up dispatcher unit install (rh #948433)
Lennart sez:

"Oh, I wasn't aware it is short-lived only. In that case, drop the
multi-user.target bit, and just make it create the dbus alias.

[Install]
Alias=dbus-org.freedesktop.nm-dispatcher.service

And yeah, adding Also=NetworkManager-dispatcher.service to
NetworkManager.service certainly would be a good idea."
2013-08-06 15:58:55 -05:00
Dan Williams
06a415d9ea systemd: add service for dispatcher (rh #948433) 2013-06-03 10:53:07 -05:00