qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 17/34] qerror: drop QERR_SOCKET_CONNECT_IN_PROGR


From: Michael Roth
Subject: Re: [Qemu-devel] [PATCH 17/34] qerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS
Date: Fri, 3 Aug 2012 13:26:27 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Aug 02, 2012 at 02:08:48PM -0300, Luiz Capitulino wrote:
> On Thu, 2 Aug 2012 11:54:11 -0500
> Michael Roth <address@hidden> wrote:
> 
> > On Wed, Aug 01, 2012 at 10:02:37PM -0300, Luiz Capitulino wrote:
> > > This error is currently returned by inet_connect_opts(), however
> > > it causes the follow spurious message on HMP:
> > > 
> > >     (qemu) migrate tcp:0:4444
> > >     migrate: Connection can not be completed immediately
> > >     (qemu)
> > > 
> > > But migration succeeds.
> > 
> > I think the core issue is that inet_connect_opts() passes back the
> > QERR_SOCKET_CONNECT_IN_PROGRESS via Error (which is fine), but that
> > we have users that erroneous pass this error up the stack, when really,
> > when specifying blocking=on as one of the options, they should be
> > expecting and doing specific handling for this error.
> 
> You're right here.
> 
> > So if we fix that (by simply using a local Error when doing the call and
> > using error_propagate() for non QSCIP errors), I think we can basically
> > drop patches 14-17 by fixing the callers in that manner and just giving 
> > QSCIP
> > it's own error class.
> 
> I don't think QSCIP errors is something we should report to QMP clients, at
> least not for the use-case this patch is about, hence we should not have
> a specific error class for this.

But we do have internal users besides QMP, and in this case they're
interested in a specific error. What if we generalized it to EAGAIN or
something? It's seems to me a fairly reasonable exception since it's one
of the few errno-style errors that we don't generally propagate up the
stack and need to check for explicitly...

> 
> As pointed out by Markus in his review, keeping the in_progress flag 
> introduced
> by patch 14/34 should be enough to drop patches 15 and 16.

Although, being an exceptional case I guess having an "in_progress" field
to functions would use it is reasonable...

I think I'd still prefer a class for QSCIP/EAGAIN that we could use for
socket utility functions, but I'm okay with an in_progress param.

> 
> > Relying on the errno result was something these socket errors were
> > specifically meant to fix, since errno is set multiple times
> > throughout the function and extracting an errno reliably requires
> > callers to examine all the possible error paths and errno setters. So I
> > think it's a regression to go back to the old behavior, and these were
> > issues found in inet_connect() when we attempted to generalize it's
> > usage for non-blocking connections.
> 
> I'm not completely sure I agree because the new error format doesn't allow
> callers to programatically know the cause of an failure. That's what errno

Is error_get_class() not to be used for this purpose? It seems like a
good thing to allow for in the odd circumstances where we do end up
adding new error classes (unless the notion of error classes is purely
legacy support for ones that libvirt is dependent on, and new ones will
never be added?)

> callers to programatically know the cause of an failure. That's what errno
> is for, though.

But it's just simply unusable when calling into a function that has
multiple paths that can set it (or clobber it). Errno values frequently
require the context of the function that set it to do anything intelligent,
which is why QSCIP was added to remove that burden from users of
inet_connect_opts() and friends.

It's good that errors are no longer tethered to the errors
descriptions/parameters and that that has amounted to a big reduction
in the number of error classes we have, but that doesn't mean we shouldn't
be open to added new error classes in the future, where it makes sense.

But, again, an in_progress param seems like a workable compromise here, I
just think prefering this approach over new error classes may lead to
unecessary code churn in the future.

> 
> But I'll drop the patch that changes inet_connect() to return errno,
> so it's not worth it to discuss this specific case.
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]