Bug 45520 - [PATCH] Introduce --nopidfile
Summary: [PATCH] Introduce --nopidfile
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: John (J5) Palmieri
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: dbus-1.5
  Show dependency treegraph
 
Reported: 2012-02-01 17:30 UTC by Lennart Poettering
Modified: 2012-02-13 10:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
systemd: drop machine UUID generation for unit file (1.28 KB, patch)
2012-02-01 17:31 UTC, Lennart Poettering
Details | Splinter Review
systemd: don't remove PID file explicitly in unit file (1.62 KB, patch)
2012-02-01 17:32 UTC, Lennart Poettering
Details | Splinter Review
bus: introduce --nopidfile switch to disable writing of PID files (6.62 KB, patch)
2012-02-09 17:23 UTC, Lennart Poettering
Details | Splinter Review
Replace a series of booleans, all (apparently) alike, with flags (9.14 KB, patch)
2012-02-10 04:45 UTC, Simon McVittie
Details | Splinter Review

Description Lennart Poettering 2012-02-01 17:30:44 UTC
Now that we achieve sub-second userspace boot times with systemd it's a good idea to get rid of unnnecessary processes we start at boot. The dbus service file currently invokes two which we can easily drop without replacement, since they are completely unnecessary since quite some time.
Comment 1 Lennart Poettering 2012-02-01 17:31:27 UTC
Created attachment 56483 [details] [review]
systemd: drop machine UUID generation for unit file
Comment 2 Lennart Poettering 2012-02-01 17:32:00 UTC
Created attachment 56484 [details] [review]
systemd: don't remove PID file explicitly in unit file
Comment 3 Simon McVittie 2012-02-07 08:50:17 UTC
(In reply to comment #1)
> systemd: drop machine UUID generation for unit file

Looks fine, fixed in git for 1.5.10.

(In reply to comment #2)
> systemd: don't remove PID file explicitly in unit file

If the system dbus-daemon crashes, would systemd ever attempt to restart it? If it would, with this change it'd fail, because the new dbus-daemon won't cope with the orphaned pid file (Bug #45713).

I believe the official line is still that restarting the system dbus-daemon is unsupported, though, so perhaps that doesn't matter.

Or, since the pid file is basically useless under systemd, one way to deal with that would be to add a --nopidfile option (which would override system.conf, just like --nofork does) and use it in dbus.service.in.

With hindsight, <fork/> and <pidfile/> should never have been in system.conf - we should have just said that sysvinit-style init scripts should specify "--system --fork --pidfile=..." - but that'd be an incompatible change for traditional-init systems now, so we're basically stuck with it.

Happily, the systemd unit is in dbus itself, so we can do The Right Thing with command-line options there.
Comment 4 Lennart Poettering 2012-02-09 10:44:20 UTC
(In reply to comment #3)

> (In reply to comment #2)
> > systemd: don't remove PID file explicitly in unit file
> 
> If the system dbus-daemon crashes, would systemd ever attempt to restart it? If
> it would, with this change it'd fail, because the new dbus-daemon won't cope
> with the orphaned pid file (Bug #45713).
> 
> I believe the official line is still that restarting the system dbus-daemon is
> unsupported, though, so perhaps that doesn't matter.
> 
> Or, since the pid file is basically useless under systemd, one way to deal with
> that would be to add a --nopidfile option (which would override system.conf,
> just like --nofork does) and use it in dbus.service.in.
> 
> With hindsight, <fork/> and <pidfile/> should never have been in system.conf -
> we should have just said that sysvinit-style init scripts should specify
> "--system --fork --pidfile=..." - but that'd be an incompatible change for
> traditional-init systems now, so we're basically stuck with it.
> 
> Happily, the systemd unit is in dbus itself, so we can do The Right Thing with
> command-line options there.

On Fedora at least we explicitly don't support restarting D-Bus. But you are right --nopidfile might be a nice fix here. I'll look into that.
Comment 5 Lennart Poettering 2012-02-09 17:23:18 UTC
Created attachment 56844 [details] [review]
bus: introduce --nopidfile switch to disable writing of PID files

OK, here's a patch that introduces --nopidfile and makes use of it in the systemd unit file.
Comment 6 Lennart Poettering 2012-02-09 17:25:17 UTC
Renaming bug to reflect more appropriately what this is about now.
Comment 7 Simon McVittie 2012-02-10 02:07:23 UTC
Comment on attachment 56844 [details] [review]
bus: introduce --nopidfile switch to disable writing of PID files

Review of attachment 56844 [details] [review]:
-----------------------------------------------------------------

Applied, thanks.

::: bus/bus.c
@@ +270,4 @@
>  				BusConfigParser  *parser,
>                                  const DBusString *address,
>                                  dbus_bool_t      systemd_activation,
> +                                dbus_bool_t      write_pidfile,

Ah, the "multiple boolean arguments" anti-pattern.

I'm very tempted to turn this into a flags argument for clarity (BUS_CONTEXT_WRITE_PIDFILE | BUS_CONTEXT_SYSTEMD_ACTIVATION) but for now I'll just apply your patch.
Comment 8 Simon McVittie 2012-02-10 04:45:09 UTC
Created attachment 56862 [details] [review]
Replace a series of booleans, all (apparently) alike, with  flags

This makes it a bit clearer what's going on.

---

How's this?
Comment 9 Lennart Poettering 2012-02-10 11:59:30 UTC
(In reply to comment #8)
> Created attachment 56862 [details] [review] [review]
> Replace a series of booleans, all (apparently) alike, with  flags
> 
> This makes it a bit clearer what's going on.
> 
> ---
> 
> How's this?

Looks good to me! Thanks for reworking this!
Comment 10 Simon McVittie 2012-02-13 10:24:07 UTC
Fixed in git for 1.5.10 (including my extra patch - thanks for reviewing)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.