qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* qemu-pr-helper -v suppresses errors, isn't that weird?
@ 2020-06-18  5:32 Markus Armbruster
  2020-06-18 12:15 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Armbruster @ 2020-06-18  5:32 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

prh_co_entry() reports reports errors reading requests / writing
responses only when @verbose (command line -v); relevant code appended
for you convenience.

Sure these are *errors*?  The program recovers and continues, and this
is deemed normal enough to inform the user only when he specifically
asks for it.  Yet when we inform, we format it as an error.  Should we
tune it down to warnings?


static void coroutine_fn prh_co_entry(void *opaque)
{
    [...]
    while (atomic_read(&state) == RUNNING) {
        [...]
        sz = prh_read_request(client, &req, &resp, &local_err);
        if (sz < 0) {
            break;
        }
        [...]
        if (prh_write_response(client, &req, &resp, &local_err) < 0) {
            break;
        }
    }
    if (local_err) {
        if (verbose == 0) {
            error_free(local_err);
        } else {
            error_report_err(local_err);
        }
    }

out:
    qio_channel_detach_aio_context(QIO_CHANNEL(client->ioc));
    object_unref(OBJECT(client->ioc));
    g_free(client);
}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: qemu-pr-helper -v suppresses errors, isn't that weird?
  2020-06-18  5:32 qemu-pr-helper -v suppresses errors, isn't that weird? Markus Armbruster
@ 2020-06-18 12:15 ` Paolo Bonzini
  2020-06-22  8:28   ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2020-06-18 12:15 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On 18/06/20 07:32, Markus Armbruster wrote:
> prh_co_entry() reports reports errors reading requests / writing
> responses only when @verbose (command line -v); relevant code appended
> for you convenience.
> 
> Sure these are *errors*?  The program recovers and continues, and this
> is deemed normal enough to inform the user only when he specifically
> asks for it.  Yet when we inform, we format it as an error.  Should we
> tune it down to warnings?

They are errors, but they're errors in the client rather than in
qemu-pr-helper.c itself.

Paolo

> 
> static void coroutine_fn prh_co_entry(void *opaque)
> {
>     [...]
>     while (atomic_read(&state) == RUNNING) {
>         [...]
>         sz = prh_read_request(client, &req, &resp, &local_err);
>         if (sz < 0) {
>             break;
>         }
>         [...]
>         if (prh_write_response(client, &req, &resp, &local_err) < 0) {
>             break;
>         }
>     }
>     if (local_err) {
>         if (verbose == 0) {
>             error_free(local_err);
>         } else {
>             error_report_err(local_err);
>         }
>     }
> 
> out:
>     qio_channel_detach_aio_context(QIO_CHANNEL(client->ioc));
>     object_unref(OBJECT(client->ioc));
>     g_free(client);
> }
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: qemu-pr-helper -v suppresses errors, isn't that weird?
  2020-06-18 12:15 ` Paolo Bonzini
@ 2020-06-22  8:28   ` Markus Armbruster
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2020-06-22  8:28 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 18/06/20 07:32, Markus Armbruster wrote:
>> prh_co_entry() reports reports errors reading requests / writing
>> responses only when @verbose (command line -v); relevant code appended
>> for you convenience.
>> 
>> Sure these are *errors*?  The program recovers and continues, and this
>> is deemed normal enough to inform the user only when he specifically
>> asks for it.  Yet when we inform, we format it as an error.  Should we
>> tune it down to warnings?
>
> They are errors, but they're errors in the client rather than in
> qemu-pr-helper.c itself.

The error message makes it look like the error was in qemu-pr-helper.

Also, continuing after reporting an error as if nothing happened smells
suspiciously.  Even when it's not wrong, it's prone to catch a wary
reader's eye.

What do you think about something like

    warn_reportf_err(local_err, "client trouble: ");

Yes, "client trouble" isn't so hot, but I lack the understanding to do
better.

> Paolo
>
>> 
>> static void coroutine_fn prh_co_entry(void *opaque)
>> {
>>     [...]
>>     while (atomic_read(&state) == RUNNING) {
>>         [...]
>>         sz = prh_read_request(client, &req, &resp, &local_err);
>>         if (sz < 0) {
>>             break;
>>         }
>>         [...]
>>         if (prh_write_response(client, &req, &resp, &local_err) < 0) {
>>             break;
>>         }
>>     }
>>     if (local_err) {
>>         if (verbose == 0) {
>>             error_free(local_err);
>>         } else {
>>             error_report_err(local_err);
>>         }
>>     }
>> 
>> out:
>>     qio_channel_detach_aio_context(QIO_CHANNEL(client->ioc));
>>     object_unref(OBJECT(client->ioc));
>>     g_free(client);
>> }
>> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-22  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18  5:32 qemu-pr-helper -v suppresses errors, isn't that weird? Markus Armbruster
2020-06-18 12:15 ` Paolo Bonzini
2020-06-22  8:28   ` Markus Armbruster

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).