[RFC] Patch to allow a DBusConnection to be recreated from an fd

Lennart Poettering mzqohf at 0pointer.de
Tue Mar 5 05:46:51 PST 2013


On Tue, 05.03.13 11:54, James Hunt (james.hunt at ubuntu.com) wrote:

> As of version 1.6, Upstart supports stateful re-exec. This works fine except
> that any clients connected to it via D-Bus at the time it re-execs have their
> connections severed. This is handled currently by having those jobs respawn. A
> better solution would be to allow Upstart to recreate the DBusConnections
> post-re-exec.
> 
> The 2 patches attached provide the ability for such a D-Bus application to
> restart and maintain existing D-Bus connections by:
> 
> - Making _dbus_connection_get_address() public as dbus_connection_get_address().
> 
> - Adding a new dbus_connection_open_from_fd() call that allows a DBusConnection
> to be recreated from an existing open file descriptor.
> 
> The first would allow Upstart to encode the address associated with the fd when
> passing state to the new instance, whilst the second change allows that
> information to be used to recreate the original DBusConnection.

This is not easy as it sounds. DBusConnection contains a lot of state,
including buffers for incomplete messages. How do you plan to
serialize/deserialize that? If your patch doesn't cover that your patch
is incomplete and misleading, since it suggests that you wouldn't need
to care about the serialization of that state information, but you
actually do.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the dbus mailing list