<div dir="ltr">Actually I think I just answered my own question and in the process realized that I didn't provide enough context in my original question. There is a race condition in my code because when service B receives SIGTERM, it calls <a href="https://developer.gnome.org/gio/stable/GDBusConnection.html#g-dbus-connection-flush-sync">g_dbus_connection_flush_sync</a> after a <a href="https://developer.gnome.org/gio/stable/GDBusProxy.html#g-dbus-proxy-call">g_dbus_proxy_call</a> to service A in an incorrect attempt to ensure that service A has handled the DBus proxy call. The problem with this is that g_dbus_connection_flush_sync ensures all outgoing messages are sent over the DBus connection but doesn't wait around for replies to those messages. Service B should instead call <a href="https://developer.gnome.org/gio/stable/GDBusProxy.html#g-dbus-proxy-call-sync">g_dbus_proxy_call_sync</a> and call neither g_dbus_connection_flush_sync nor g_dbus_proxy_call. Please correct me if I am missing something.<div><br></div><div>On a separate note, how long does systemd wait after sending a SIGTERM to a service before sending it a SIGKILL? Is it reasonable to assume that a few g_dbus_proxy_call_sync calls would complete in that time if the slowest part of those calls is just the standard overhead of a DBus call? I ask because currently I acquire a <a href="http://www.freedesktop.org/wiki/Software/systemd/inhibit/">shutdown inhibitor</a> in service B, and I now suspect this is unnecessary.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Be well,</div><div class="gmail_extra">Kurt</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 9:49 AM, Kurt von Laven <span dir="ltr"><<a href="mailto:kurt@endlessm.com" target="_blank">kurt@endlessm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Both services A and B specify Requires=dbus.service and After=dbus.service. If I am interpreting everything that's being said correctly, there is a race condition in my code since service A's implementation doesn't require it to wait until it has processed the method call from service B before it stops listening for method calls.<span style="font-size:12.8000001907349px"> Does that sound right?</span><div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 6:31 AM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>On Thu, 02.04.15 13:07, Michael Biebl (<a href="mailto:mbiebl@gmail.com" target="_blank">mbiebl@gmail.com</a>) wrote:<br>
<br>
> 2015-04-02 13:03 GMT+02:00 Lennart Poettering <<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>>:<br>
> > On Thu, 02.04.15 13:00, Michael Biebl (<a href="mailto:mbiebl@gmail.com" target="_blank">mbiebl@gmail.com</a>) wrote:<br>
> ><br>
> >> 2015-04-02 11:06 GMT+02:00 Lennart Poettering <<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>>:<br>
> >> > If you want to ensure that bus communication still works in your<br>
> >> > shutdown code, you hence need to make sure you place<br>
> >> > After=dbus.service in your services, so that you are shut down before<br>
> >> > dbus is.<br>
> >><br>
> >> Type=dbus service currently only get a dependency on dbus.socket (via<br>
> >> After=basic.target).<br>
> ><br>
> > Yeah, and rightfully so. I mean, a service really should be able to<br>
> > shutdown if dbus is dead. In fact, it should be able to shutdown in<br>
> > pretty much any situation...<br>
><br>
> Apparently they don't. There were all sorts of failures caused by dbus<br>
> being shut down too early.<br>
><br>
> <a href="https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1438612" target="_blank">https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1438612</a> is one of<br>
> the related bug reports afair.<br>
<br>
</span>Hmm? I really don't see how the NFS vs wpa_supplicant issue has<br>
anything to do with dbus? NFS doesn't care about dbus at all...<br>
<br>
You need to order wpa_supplicant and NM Before=remote-fs-pre.target<br>
and pull it it via Wants=remote-fs-pre.target. With that in place<br>
during shutdown the mounts will be unmounted first, and NM/wpa only<br>
shut down after that. See systemd.special(7) for details.<br>
<br>
I really don't see what dbus has to do with all this...<br>
<div><div><br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr"><span><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Kurt von Laven | Endless Mobile |  </span><a href="http://endlessm.com/" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">EndlessM.com</span></a></span><br></div></div>
</font></span></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Kurt von Laven | Endless Mobile |  </span><a href="http://endlessm.com/" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);background-color:transparent;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">EndlessM.com</span></a></span><br></div></div>
</div></div>