dbus_shutdown call

Ge@@ru geaaru at gmail.com
Wed Jan 9 00:47:51 PST 2008


On Wed, 2008-01-09 at 10:38 +0200, Naveen Verma wrote:
> if i'm sure that my application will be soon died?
> 
> I did not understand this...
> 
> Well anyway if you can close the shared connection which you open with
> the system bus then you can also shut down. So I think first try to
> close the connection. You will find the answer :) 
> 
> -Br
> Naveen
> 
A simple dbus application:
- do a connection to system bus;
- call method ListNames of org.freedesktop.DBus service;
- print list of services;
- exit;

In this case on my application i do:
- dbus_bus_get (system bus)
- dbus_bus_request_name;
- ... do method call
- dbus_connection_unref()
- dbus_shutdown
- exit

On session bus this works fine, on system bus 
before exit an abort is handled for:
 dbus_shutdown() called but connections were still live. This probably
means the application did not drop all its references to bus
connections.

So, i can't shutdown on system bus.

Ge@@ru

> On Jan 9, 2008 9:44 AM, Ge@@ru <geaaru at gmail.com> wrote:
>         
>         On Tue, 2008-01-08 at 16:37 +0200, Naveen Verma wrote:
>         > As per my understanding, dbus re-use the share connection.
>         So if you
>         > do dbus_bus_get(). Then it checks for any existing free
>         connection 
>         > with the given bus, if it available then it allocate it for
>         > application, if no free connection available then it create
>         a new
>         > connection and keep its record to reuse it. Thats why we
>         can't close 
>         > the shared connection, if we try to do so , dbus gives a
>         runtime
>         > error.
>         >
>         > But a private connection is dedicated to calling application
>         and
>         > should be close by application at the end.
>         >
>         > Not sure but in my understanding this rule is followed more
>         strictly
>         > in the case of system bus because the shared connections are
>         system
>         > wide and can be shared between different sessions. While in
>         the case 
>         > of session bus the shared connections are limited to only
>         particular
>         > session.
>         >
>         > -Br
>         > Naveen
>         >
>         
>         
>         This could be a valid solution for service always active, but
>         for an
>         application that is connect to "system bus" and that for
>         example do a
>         query for known Service active and exit, then however if i
>         call
>         dbus_shutdown or no, when application die still internal dbus
>         variables 
>         are deallocated, so why not permit to call dbus_shutdown on
>         system bus
>         if i'm sure that my application will be soon died?
>         
>         Thank you very very much for your replies!
>         
>         Ge@@ru
>         
>         
>         
>         
>         
>         
>         
>         > On Jan 8, 2008 3:55 PM, Ge@@ru <geaaru at gmail.com> wrote:
>         >         On dbus session (share connection) works fine. Only
>         on system 
>         >         session i
>         >         have this problem.
>         >
>         >         So, why i can't close this shared connection?
>         >
>         >         Thanks
>         >
>         >         Ge@@ru
>         >
>         >
>         >         On Tue, 2008-01-08 at 16:01 +0200, Naveen Verma
>         wrote: 
>         >         > Hi,
>         >         >
>         >         > Probably you are taking a shared connection which
>         you can't
>         >         close,
>         >         > thats why this error is coming. What if you could
>         try to 
>         >         take a
>         >         > private connection (dbus_bus_get_private()), and
>         >         > close(dbus_connection_close()) and
>         >         > unreferenced(dbus_connection_unref()) after use
>         and then 
>         >         call
>         >         > dbus_shutdown()?
>         >         >
>         >         > -Br
>         >         > Naveen
>         >         >
>         >         > On Jan 8, 2008 2:51 PM, Ge@@ru <geaaru at gmail.com>
>         wrote:
>         >         >         Hi at all,
>         >         >          i want use dbus_shutdown function for
>         deallocate
>         >         internal
>         >         >         dbus variable
>         >         >         before exit from my application and avoid
>         valgrind
>         >         warning.
>         >         >         On bus session this works fine but on
>         system bus i
>         >         have this
>         >         >         abort: 
>         >         >         process 26586: dbus_shutdown() called but
>         >         connections were
>         >         >         still live.
>         >         >         This probably means the application did
>         not drop all 
>         >         its
>         >         >         references to
>         >         >         bus connections
>         >         >
>         >         >         Why? Have you an idea how can i resolve
>         this
>         >         problem? 
>         >         >
>         >         >         Thanks in advance.
>         >         >
>         >         >         Ge@@ru
>         >         >
>         >         >
>         _______________________________________________ 
>         >         >         dbus mailing list
>         >         >         dbus at lists.freedesktop.org
>         >         >
>         http://lists.freedesktop.org/mailman/listinfo/dbus
>         >         >
>         >
>         >
>         >
>         
>         
> 



More information about the dbus mailing list