[openstack-dev] [Oslo] RPC protocol violations

Ray Pekowski pekowski at gmail.com
Tue Jan 29 05:34:47 UTC 2013


On Mon, Jan 28, 2013 at 1:57 PM, Russell Bryant <rbryant at redhat.com> wrote:

> On 01/28/2013 02:48 PM, Eric Windisch wrote:
> >> 31: LOG.error(_("RPC message did not include method."))
> >> Why not handle it like AMQP and at least return something. Plus the
> gain would be some consistency. Here is what AMQP does:
> >> if not method:
> >> LOG.warn(_('no method for message: %s') % message_data)
> >> ctxt.reply(_('No method for message: %s') % message_data,
> >> connection_pool=self.connection_pool)
> >> return
> >
> >
> > I began looking to do as you suggest and realized the amqp implemenation
> might be doing this wrong, too?
> >
> > Isn't this just returning the error as a string back to the caller? What
> if the method the caller was seeking was returning a string already? What
> if it was expecting some OTHER data type? Shouldn't this create, serialize,
> and send an Exception?
> >
> > Perhaps something as simple as the following?
> >
> > ctxt.reply(failure=RPCException(_('No method for message: %s') %
> message_data)
>
> Yeah, something like that.  You're right that this is a bug in amqp.py,
> it needs to be returning an exception.
>

Actually, it probably doesn't make sense to do very much here.  I now like
Eric's idea of simply logging the error and not responding at all.  The
most likely reason for not getting a 'method' is the message is totally
corrupt, which means it is unlikely to have the msg_id which identifies how
to route the response back to the caller.  Therefore, any attempt to
respond will probably result in the message being routed to the bit bucket
in the sky or at worst cause a stack dump.

Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130128/18689df5/attachment.html>


More information about the OpenStack-dev mailing list