dbus-viewer anomalies

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

dbus-viewer anomalies

Lennart Poettering-2
Hi!

I am currently working on adding introspection support to the DBUS
interface of Avahi. I am experiencing some anomalies with dbus-viewer,
probably some kind of race condition.

My DBUS server makes use of the glib main loop but for my DBUS methods
I do not use the gobject stuff.  My introspection XML fragments are
rather long,  see

     http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/avahi-daemon/Server.introspect?root=flexmdns&view=auto

for an example.

When run as is, dbus-viewer fails undeterministacally to parse and
show the XML data specified above. No error message is
logged. Sometimes it is able to download and parse the XML data,
sometimes it is not, showing no results, just white space. If I slow
down either the server side or dbus-view with valgrind or strace, it
always succeeds in downloading and parsing the XML data. dbus-send is
always able to download and print the data.

I started to debug dbus-viewer with gdb, but stopped it being annoyed
by the fact that dbus-viewer uses threads (why? is there any good
reason complicating things that much? this only creates bugs to find,
... like this one).  the function call
dbus_g_proxy_call() on line 300 of dbus-viewer.c freezes and never
returns. (it doesn't even timeout, as it seems)

<snip>

(gdb) bt
#0  0xb79891c3 in poll () from /lib/tls/libc.so.6
#1  0xb7f098fd in _dbus_poll (fds=0xfffffffc, n_fds=-4, timeout_milliseconds=-4) at dbus-sysdeps.c:1879
#2  0xb7f02ce8 in unix_do_iteration (transport=0x8085528, flags=6, timeout_milliseconds=24953) at dbus-transport-unix.c:1021
#3  0xb7f01b3c in _dbus_transport_do_iteration (transport=0x8085528, flags=6, timeout_milliseconds=-4) at dbus-transport.c:715
#4  0xb7eeb8b6 in _dbus_connection_do_iteration_unlocked (connection=0x8085880, flags=6, timeout_milliseconds=24953) at dbus-connection.c:1050
#5  0xb7eed6c8 in _dbus_connection_block_pending_call (pending=0x8134d88) at dbus-connection.c:2619
#6  0xb7efc70f in dbus_pending_call_block (pending=0xfffffffc) at dbus-pending-call.c:310
#7  0xb7f21907 in dbus_g_proxy_end_call_internal (proxy=0x8134900, call_id=1, error=0x8134968, first_arg_type=64, args=0xb74e93e4 "ø\223N·") at dbus-gproxy.c:2098
#8  0xb7f221ae in dbus_g_proxy_call (proxy=0x8134900, method=0xfffffffc <Address 0xfffffffc out of bounds>, error=0xfffffffc, first_arg_type=135481600) at dbus-gproxy.c:2347
#9  0x0804c9d1 in load_from_service_thread_func (thread_data=0x8134960) at dbus-viewer.c:300
#10 0xb7a4aebf in g_static_private_free () from /usr/lib/libglib-2.0.so.0
#11 0xb7a912bb in start_thread () from /lib/tls/libpthread.so.0
#12 0xb799200e in clone () from /lib/tls/libc.so.6
</snip>

If the introspection data contains a function returning an object path
("o"), dbus-view never shows anything sensible. I don't know if the
problem is related.

BTW: The introspection DTD shipped with DBUS is rather broken, it
judges the introspection data of org.freedesktop.DBus as invalid. I
corrected the DTD to match what the DBUS spec says. Please consider
merging this into upstream:

    http://0pointer.de/cgi-bin/viewcvs.cgi/*checkout*/trunk/avahi-daemon/introspect.dtd?root=flexmdns

Changes include:
        * don't force an order of the elements of a node and of an interface.
        * do not require a "name" attribute on nodes.
        * allow multiple arguments and annotations per signal and per property

And please consider making it available as

    http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd

which is what is advertised in all example introspection XML fragments
and in the data from org.freedesktop.DBus.

This is DBUS 0.35.2.

Lenart

--
Lennart Poettering; lennart [at] poettering [dot] de
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.de/lennart/
--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

Havoc Pennington
On Sat, 2005-07-30 at 18:05 +0200, Lennart Poettering wrote:
> I started to debug dbus-viewer with gdb, but stopped it being annoyed
> by the fact that dbus-viewer uses threads (why? is there any good
> reason complicating things that much? this only creates bugs to find,
> ... like this one).

The main reason was to test the thread capabilities of libdbus and the
glib bindings. It really should not create much complexity if libdbus
threading works, which is a big "if" of course, but that's the whole
point of testing it ;-)

>  the function call
> dbus_g_proxy_call() on line 300 of dbus-viewer.c freezes and never
> returns. (it doesn't even timeout, as it seems)

Probably some issue with the dbus-connection.c threading and blocking,
just needs to be debugged. The backtrace doesn't tell me much but maybe
the verbose spew would be helpful.

> If the introspection data contains a function returning an object path
> ("o"), dbus-view never shows anything sensible. I don't know if the
> problem is related.

Doubtful. Looking at the code I don't really see why that would break,
probably some simple screwup.

> BTW: The introspection DTD shipped with DBUS is rather broken, it
> judges the introspection data of org.freedesktop.DBus as invalid. I
> corrected the DTD to match what the DBUS spec says. Please consider
> merging this into upstream:
>
>     http://0pointer.de/cgi-bin/viewcvs.cgi/*checkout*/trunk/avahi-daemon/introspect.dtd?root=flexmdns
>
> Changes include:
>         * don't force an order of the elements of a node and of an interface.
>         * do not require a "name" attribute on nodes.
>         * allow multiple arguments and annotations per signal and per property
>

If nobody sees a problem with it I'll put it in (I don't know much about
dtds myself)

> And please consider making it available as
>
>     http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd
>
> which is what is advertised in all example introspection XML fragments
> and in the data from org.freedesktop.DBus.

Added to the TODO for 1.0. It should be autocopied from CVS, is the
reason it isn't entirely trivial to post this (though it isn't rocket
science anyhow).

Thanks for the bug reports.

Havoc


--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

Piotr ZIelinski
In reply to this post by Lennart Poettering-2
Lennart Poettering <mzqohf@...> writes:

> I am currently working on adding introspection support to the DBUS
> interface of Avahi. I am experiencing some anomalies with dbus-viewer,

I don't know whether this is related, but I had similar problems with
dbus-viewer yesterday.  It turned out that the order of arguments in one of
dbus_g_proxy_call was wrong. See

https://bugs.freedesktop.org/show_bug.cgi?id=3920

It contains a small patch that fixes the problem.

Piotr

--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

John Palmieri-2
In reply to this post by Havoc Pennington
On Sat, 2005-07-30 at 21:49 -0400, Havoc Pennington wrote:
> On Sat, 2005-07-30 at 18:05 +0200, Lennart Poettering wrote:
<snip>

> > BTW: The introspection DTD shipped with DBUS is rather broken, it
> > judges the introspection data of org.freedesktop.DBus as invalid. I
> > corrected the DTD to match what the DBUS spec says. Please consider
> > merging this into upstream:
> >
> >     http://0pointer.de/cgi-bin/viewcvs.cgi/*checkout*/trunk/avahi-daemon/introspect.dtd?root=flexmdns
> >
> > Changes include:
> >         * don't force an order of the elements of a node and of an interface.
> >         * do not require a "name" attribute on nodes.
> >         * allow multiple arguments and annotations per signal and per property
> >
>
> If nobody sees a problem with it I'll put it in (I don't know much about
> dtds myself)

It looks good to me from my days of writing dtd's though perhaps Dave
should give it a once over since he wrote the original dtd.
 
--
John (J5) Palmieri <[hidden email]>

--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

Waldo Bastian
In reply to this post by Havoc Pennington
On Sunday 31 July 2005 03:49, Havoc Pennington wrote:

> On Sat, 2005-07-30 at 18:05 +0200, Lennart Poettering wrote:
> > And please consider making it available as
> >
> >     http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd
> >
> > which is what is advertised in all example introspection XML fragments
> > and in the data from org.freedesktop.DBus.
>
> Added to the TODO for 1.0. It should be autocopied from CVS, is the
> reason it isn't entirely trivial to post this (though it isn't rocket
> science anyhow).
I have made it available (semi-autocopied from CVS) under
        http://standards.freedesktop.org/dbus/introspect-1.0.dtd

Now you either need a redirect on the website, or change the url in dbus / the
examples.

Cheers,
Waldo

--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

Lennart Poettering-2
In reply to this post by Havoc Pennington
On Sat, 30.07.05 21:49, Havoc Pennington ([hidden email]) wrote:

> >  the function call
> > dbus_g_proxy_call() on line 300 of dbus-viewer.c freezes and never
> > returns. (it doesn't even timeout, as it seems)
>
> Probably some issue with the dbus-connection.c threading and blocking,
> just needs to be debugged. The backtrace doesn't tell me much but maybe
> the verbose spew would be helpful.

http://0pointer.de/public/dbus-verbose-bt

BTW: If I select another service in the drop down list while the query
on avahi's introspection data is still running, dbus-viewer creates a
new thread for each one without terminating the old one. After startup
they hang in "_dbus_condvar_wait".

I must correct the bug report in my last mail. Sometimes dbus-viewer
hangs completely, sometimes it works fine and sometimes it comes to
life again after a minute or so and shows sensible data. Strange!

> > If the introspection data contains a function returning an object path
> > ("o"), dbus-view never shows anything sensible. I don't know if the
> > problem is related.
>
> Doubtful. Looking at the code I don't really see why that would break,
> probably some simple screwup.

I cannot reproduce this error anyway, so please ignore it. It was
probably just an instance of the error desribed above.

> > BTW: The introspection DTD shipped with DBUS is rather broken, it
> > judges the introspection data of org.freedesktop.DBus as invalid. I
> > corrected the DTD to match what the DBUS spec says. Please consider
> > merging this into upstream:
> >
> >     http://0pointer.de/cgi-bin/viewcvs.cgi/*checkout*/trunk/avahi-daemon/introspect.dtd?root=flexmdns
> >
> > Changes include:
> >         * don't force an order of the elements of a node and of an interface.
> >         * do not require a "name" attribute on nodes.
> >         * allow multiple arguments and annotations per signal and per property
> >
>
> If nobody sees a problem with it I'll put it in (I don't know much about
> dtds myself)

May I suggest adding a new element to the introsprection XML format?
a "description" or something similar which might contain some human
readable documentation for the interface/method/signal/property? This
could be used by dbus-viewer to enrich the shown function signature
data.

On python-dbus this element could be filled with data from the
function's documentation string (""").

Yes I know, this could be done with annotations, but cramming this
into the "value" of an annotation would be ugly, I think.

> > And please consider making it available as
> >
> >     http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd
> >
> > which is what is advertised in all example introspection XML fragments
> > and in the data from org.freedesktop.DBus.
>
> Added to the TODO for 1.0. It should be autocopied from CVS, is the
> reason it isn't entirely trivial to post this (though it isn't rocket
> science anyhow).

BTW: the DTD of the bus config file format should be put at a similar
location. It currently advertised as
 
   http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd

The only location where it is currently available is here:

   http://dbus.freedesktop.org/doc/busconfig.dtd

Lennart

--
Lennart Poettering; lennart [at] poettering [dot] de
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.de/lennart/
--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: dbus-viewer anomalies

Lennart Poettering-2
In reply to this post by Piotr ZIelinski
On Sun, 31.07.05 14:28, Piotr ZIelinski ([hidden email]) wrote:

>
> Lennart Poettering <mzqohf@...> writes:
>
> > I am currently working on adding introspection support to the DBUS
> > interface of Avahi. I am experiencing some anomalies with dbus-viewer,
>
> I don't know whether this is related, but I had similar problems with
> dbus-viewer yesterday.  It turned out that the order of arguments in one of
> dbus_g_proxy_call was wrong. See
>
> https://bugs.freedesktop.org/show_bug.cgi?id=3920
>
> It contains a small patch that fixes the problem.

I patched my local copy of dbus-viewer with your patch. Unfortunately
the problem persists.

Lennart

--
Lennart Poettering; lennart [at] poettering [dot] de
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.de/lennart/
--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus