openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Williams <patrick@stwcx.xyz>
To: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Cc: "openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	Brad Bishop <bradleyb@fuzziesquirrel.com>,
	Ed Tanous <ed@tanous.net>
Subject: Re: Emit interface added signal
Date: Thu, 18 Mar 2021 09:57:19 -0500	[thread overview]
Message-ID: <YFNqT47YVXprhEsM@heinlein> (raw)
In-Reply-To: <580c5e6c-5946-eedc-25b0-53315a0831cd@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1834 bytes --]

On Thu, Mar 18, 2021 at 04:03:21PM +0530, Ratan Gupta wrote:

> Proposal: Don't emit the interface added signal by the D-bus service if 
> we are restoring the D-Bus objects from file system.
> 
> Do we see any concern here? or any other way to fix the above issue?

Yes, this is pretty dangerous.  If you do this, mapper will not know
about your objects and they will not show up in queries.  This is
certainly not what you want.  (Mapper will delete your objects from its
cache when the service exits, and not know that you have new ones
because it did not get the signal.)

This isn't just about mapper though.  Anytime you do not emit the
signals, you then require applications to poll your service for
knowledge of your objects.

In general, you should not work around an issue in one application
(bmcweb in this case) by changing your dbus behavior.  This isn't the
first time that I've seen a similar request.

Having said this, there is one option for you.  This is completely valid,
and done by other dbus services we have, and arguably more correct than
what it sounds like you're currently doing.

   - Defer the service name registration until just before entering your
     dbus processing loop.

   - Create your restored dbus objects before this service name
     registration and use the `emitSignal=false` argument to prevent
     the signal from being emitted.

This pattern is your way of indicating "these aren't new dynamic
objects, but objects I'm creating at the beginning of my service."
When mapper sees the NameOwnerChanged signal, it will query your service
for objects and add them to its cache.  `bmcweb` won't see the
ObjectManager.InterfacesAdded signals for these static / restored
objects, but it will see them for new / dynamic objects.

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-03-18 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 10:33 Emit interface added signal Ratan Gupta
2021-03-18 14:57 ` Patrick Williams [this message]
2021-03-19  8:37   ` Ratan Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YFNqT47YVXprhEsM@heinlein \
    --to=patrick@stwcx.xyz \
    --cc=bradleyb@fuzziesquirrel.com \
    --cc=ed@tanous.net \
    --cc=openbmc@lists.ozlabs.org \
    --cc=ratagupt@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).