Bug 51282

Summary: "Could not add client names match rule" warning at startup
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: mission-controlAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: guillaume.desmottes
Version: git masterKeywords: patch
Hardware: Other   
OS: All   
Whiteboard: review+
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 23486    
Attachments: use a DEBUG instead of warning if dbus_bus_add_match failed
use a DEBUG instead of warning if dbus_bus_add_match failed

Description Guillaume Desmottes 2012-06-21 00:55:37 UTC
I get this warning  when starting MC master.

dbus-libs-1.4.10-4.fc17.i686
dbus-glib-0.92-3.fc17.x86_64


(process:7800): mcd-WARNING **: Could not add client names match rule: Key 'arg0namespace' in match rule contains junk after argument number. Only 'path' is optionally valid ('arg0path' for example).


Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6e7bde9 in g_logv (log_domain=0x45297e "mcd", log_level=G_LOG_LEVEL_WARNING, format=0x452b60 "Could not add %s match rule: %s", 
    args1=0x7fffffffcb78) at gmessages.c:758
758			G_BREAKPOINT ();
Missing separate debuginfos, use: debuginfo-install libgudev1-182-3.fc17.x86_64 libselinux-2.1.10-3.fc17.x86_64 libudev-182-3.fc17.x86_64 libuuid-2.21.2-1.fc17.x86_64 nss-3.13.4-3.fc17.x86_64 nss-util-3.13.4-2.fc17.x86_64 upower-0.9.16-1.fc17.x86_64 zlib-1.2.5-6.fc17.x86_64
(gdb) bt
#0  0x00007ffff6e7bde9 in g_logv (log_domain=0x45297e "mcd", log_level=G_LOG_LEVEL_WARNING, 
    format=0x452b60 "Could not add %s match rule: %s", args1=0x7fffffffcb78) at gmessages.c:758
#1  0x00007ffff6e7bedd in g_log (log_domain=0x45297e "mcd", log_level=G_LOG_LEVEL_WARNING, 
    format=0x452b60 "Could not add %s match rule: %s") at gmessages.c:792
#2  0x0000000000437b45 in add_match (conn=0x676770, 
    rule=0x452b90 "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0namespace='org.freedesktop.Telepathy.Client'", msg=0x452b80 "client names") at client-registry.c:347
#3  0x0000000000437be1 in watch_clients (self=0x672dc0) at client-registry.c:380
#4  0x0000000000437ca9 in mcd_client_registry_constructed (object=0x672dc0) at client-registry.c:398
#5  0x00007ffff7182c21 in g_object_newv (object_type=6970768, n_parameters=1, parameters=0x6a6db0) at gobject.c:1746
#6  0x00007ffff7183285 in g_object_new_valist (object_type=6970768, first_property_name=0x452d96 "dbus-daemon", var_args=0x7fffffffced0)
    at gobject.c:1835
#7  0x00007ffff7182520 in g_object_new (object_type=6970768, first_property_name=0x452d96 "dbus-daemon") at gobject.c:1550
#8  0x00000000004381b8 in _mcd_client_registry_new (dbus_daemon=0x67b090) at client-registry.c:513
#9  0x000000000041b621 in mcd_dispatcher_constructed (object=0x690e40) at mcd-dispatcher.c:801
#10 0x00007ffff7182c21 in g_object_newv (object_type=6806528, n_parameters=2, parameters=0x680870) at gobject.c:1746
#11 0x00007ffff7183285 in g_object_new_valist (object_type=6806528, first_property_name=0x44b201 "dbus-daemon", var_args=0x7fffffffd1d0)
    at gobject.c:1835
#12 0x00007ffff7182520 in g_object_new (object_type=6806528, first_property_name=0x44b201 "dbus-daemon") at gobject.c:1550
#13 0x000000000041b995 in mcd_dispatcher_new (dbus_daemon=0x67b090, master=0x67b120) at mcd-dispatcher.c:919
#14 0x0000000000411a48 in mcd_master_constructor (type=6743280, n_params=2, params=0x67eb30) at mcd-master.c:380
#15 0x00007ffff7182b0c in g_object_newv (object_type=6743280, n_parameters=1, parameters=0x67e900) at gobject.c:1718
#16 0x00007ffff7183285 in g_object_new_valist (object_type=6743280, first_property_name=0x448855 "dbus-daemon", var_args=0x7fffffffd520)
    at gobject.c:1835
#17 0x00007ffff7182520 in g_object_new (object_type=6743280, first_property_name=0x448855 "dbus-daemon") at gobject.c:1550
#18 0x0000000000410f04 in mcd_service_new () at mcd-service.c:182
#19 0x000000000040e80e in main (argc=1, argv=0x7fffffffd868) at mc-server.c:171
Comment 1 Simon McVittie 2012-06-21 04:17:00 UTC
(In reply to comment #0)
> (process:7800): mcd-WARNING **: Could not add client names match rule: Key
> 'arg0namespace' in match rule contains junk after argument number. Only 'path'
> is optionally valid ('arg0path' for example).

This warning is harmless: MC falls back to adding a less optimal match rule.

It will go away if you upgrade to D-Bus 1.6.

Not closing the bug because if you want to downgrade the warning, that would be a reasonable thing to do. If you don't want to downgrade it, please close as NOTABUG.

(MC is not suitable for running under fatal warnings anyway, which is tracked as Bug #23486.)
Comment 2 Guillaume Desmottes 2012-06-22 00:19:16 UTC
I'll change to a debug and I think it's worth being more explicit in the debug message so naive users like me know which D-Bus version is required.
Comment 3 Guillaume Desmottes 2012-06-22 00:21:27 UTC
Created attachment 63333 [details] [review]
use a DEBUG instead of warning if dbus_bus_add_match failed

Also, make the message more explicit to one can check is D-Bus version if he's
wondering why it failed.
Comment 4 Simon McVittie 2012-06-22 05:17:12 UTC
I agree in principle, but:

If add_match (., CLIENT_MATCH_RULE, .) fails, that just means you don't have D-Bus 1.6.

If add_match (., NAME_OWNER_RULE, .) fails, that should still be a warning, or even a critical.

I see two options:

1) Add a parameter "required_version" to add_match. If it's NULL, issue a warning (or even a critical): "Could not add %s match rule: %s". If it's non-NULL, issue a debug message: "Could not add %s match rule, which requires D-Bus %s: %s".

2) Flatten add_match into its caller, and do the error handling there.

---

While you're in the vicinity, I notice that the boolean "arg0_filtered" makes very little sense. It's set to the return from dbus_connection_add_filter(), which is documented to mean "there was enough memory"; and in any case, if we can't add the filter, MC is not going to work correctly. So I think it should go more like this:

  if (!dbus_connection_add_filter (dconn, ..._filter, self, NULL))
    g_critical ("Could not add filter for NameOwnerChanged (out of memory?)");

  dbus_error_init (&error);

  if (dbus_bus_add_match (dconn, CLIENT_MATCH_RULE, &error))
    {
      DEBUG ("...");
      dbus_error_free (&error);

      if (!dbus_bus_add_match (dconn, NAME_OWNER_RULE, &error))
        {
          g_critical ("...");
          dbus_error_free (&error);
        }
    }

(Or the equivalent with non-inlined add_match() if you prefer.)
Comment 5 Guillaume Desmottes 2012-07-02 00:51:31 UTC
Created attachment 63689 [details] [review]
use a DEBUG instead of warning if dbus_bus_add_match failed

Also, make the message more explicit to one can check is D-Bus version if he's
wondering why it failed.
Comment 6 Simon McVittie 2012-07-02 02:17:00 UTC
Ship it
Comment 7 Guillaume Desmottes 2012-07-02 03:52:38 UTC
Merged to master for 5.13.0

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.