Receiving dbus signals using low-level C API

Kimmo Hämäläinen kimmo.hamalainen at nokia.com
Thu Jan 25 05:36:21 PST 2007


On Wed, 2007-01-24 at 18:20 -0800, ext Krishna R wrote:
> Need some more help, sorry for the trouble...
> 
> I am able to send and recv fsignals fine, but i see that signals get
> dropped rarely...is that even possible?
> 
> To send the signal i do the following  steps in my app 
> 
> dbus_bus_get()
> dbus_message_new_signal()
> dbus_message_append_args()
> dbus_connection_send()
> dbus_connection_flush()
> dbus_message_unref()
> dbus_connection_unref()
> exits program.
> 
> One the recv side i add a match rule and set a filter function. 
> 
> If i run the send app manually a few times from cmd line, i rarely see
> in the recv terminal that the signal has not been got (i use
> fprintfs).
> It happens once in 30 or 40 tries i do. Randomly. 
> 
> I have error checks and debug print statements for each of the calls
> so i know none of calls themselves fail. Send app exits as a sucess
> but the recv side never got the signal sent. 

It sounds like this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=896

You can work around it by adding a short sleep before exiting the
sending program.

BR; Kimmo

> Are there any tips for debugging this kind of problem. Or am i missing
> something here.
> 
> Thanks!
> -Krish
> 
> On 1/24/07, John (J5) Palmieri < johnp at redhat.com> wrote:
>         On Wed, 2007-01-24 at 16:27 -0500, Havoc Pennington wrote: 
>         
>         >
>         > > 1. Is this a correct way to recv signals? Do i have to do
>         > > dbus_message_unref(message) in the filter function after
>         handling it
>         > > before i return?
>         >
>         > I don't believe so, I could misremember, but it would be
>         documented if 
>         > you did have to probably.
>         
>         Hmm, wait.  I might be misremembering too.  The filter
>         function may
>         unref for you and I think I was thinking of needing to unref
>         after
>         creating a reply message.  So if one needs to keep a message
>         around they 
>         need to ref it.
>         
>         --
>         John (J5) Palmieri <johnp at redhat.com>
>         
> 
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus


More information about the dbus mailing list