dbus fork problem

Peter Clifton pcjc2 at cam.ac.uk
Thu Apr 5 04:55:42 PDT 2007


On Thu, 2007-04-05 at 12:27 +0100, Peter Clifton wrote:
> On Thu, 2007-04-05 at 11:44 +0530, मयंक जैन (makuchaku) wrote:
> > On 4/5/07, Sean Kang <sean_kang at samsung.com> wrote:
> > > After strugging for a while, we've noticed that dbus connection doesn't seem
> > > to work with fork() system call.
> > >
> > > The connection is copied but there is no API to properly close the
> > > connection so the new connection can be made.
> > 
> > Hi Sean,
> > 
> > Though I've not used dbus-glib bindings with a system in which I had
> > to fork, but maybe you can try dbus_g_connection_unref so that the
> > refcount goes to zero & the object is finalized.
> 
> Ask the guys on the dbus list about this..

I just re-read my last post, and perhaps it came across more
aggressive / critical than I intended.

I'd like to apologise if it causes offence. I have a great deal of
respect for the dbus guys, what they have achieved is amazing.

> If you have a dbus connection (raw libdbus), and unref it to 0 ref
> counts, it DOES NOT finalise. This is a broken API IMHO, but this is the
> way dbus behaved for "shared" (default) bus connections, and some
> applications rely on the stupid ability to unref, then re-open the same
> connection!
> 
> I proposed they fix this, but it breaks behavioural (bug) compatibility
> with their stable release.
> 
> If your app knows no other libraries it has loaded is playing with dbus,
> you "might" be able to call dbus's shutdown call, but this doesn't
> really work.
> 
> In short - once dbus is in your app, you can't get it to leave. The dbus
> people I spoke to don't see this as a bug. Certainly, it is a
> corner-case of common use dbus gets.
> 
-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



More information about the dbus mailing list