[{"id":1764297,"web_url":"http://patchwork.ozlabs.org/comment/1764297/","msgid":"<0a4175fa-3586-d9ab-addb-736a17c24555@amsat.org>","list_archive_url":null,"date":"2017-09-06T18:06:59","subject":"Re: [Qemu-devel] [PATCH v1 2/2] io: include full error message in\n\twebsocket handshake trace","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"On 09/06/2017 07:40 AM, Daniel P. Berrange wrote:\n> When the websocket handshake fails it is useful to log the real\n> error message via the trace points for debugging purposes.\n> \n> Fixes bug: #1715186\n> \n> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>\n\nReviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n\n> ---\n>   io/channel-websock.c | 7 ++++---\n>   io/trace-events      | 2 +-\n>   2 files changed, 5 insertions(+), 4 deletions(-)\n> \n> diff --git a/io/channel-websock.c b/io/channel-websock.c\n> index b9cc5a1371..463c04b0aa 100644\n> --- a/io/channel-websock.c\n> +++ b/io/channel-websock.c\n> @@ -503,7 +503,7 @@ static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,\n>                               &err);\n>   \n>       if (ret < 0) {\n> -        trace_qio_channel_websock_handshake_fail(ioc);\n> +        trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(err));\n>           qio_task_set_error(task, err);\n>           qio_task_complete(task);\n>           return FALSE;\n> @@ -512,7 +512,8 @@ static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,\n>       buffer_advance(&wioc->encoutput, ret);\n>       if (wioc->encoutput.offset == 0) {\n>           if (wioc->io_err) {\n> -            trace_qio_channel_websock_handshake_fail(ioc);\n> +            trace_qio_channel_websock_handshake_fail(\n> +                ioc, error_get_pretty(wioc->io_err));\n>               qio_task_set_error(task, wioc->io_err);\n>               wioc->io_err = NULL;\n>               qio_task_complete(task);\n> @@ -543,7 +544,7 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,\n>            * client connection, as most of the time we have an\n>            * HTTP 4xx err response to send instead\n>            */\n> -        trace_qio_channel_websock_handshake_fail(ioc);\n> +        trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(err));\n>           qio_task_set_error(task, err);\n>           qio_task_complete(task);\n>           return FALSE;\n> diff --git a/io/trace-events b/io/trace-events\n> index 3d233698d0..6459f71f5b 100644\n> --- a/io/trace-events\n> +++ b/io/trace-events\n> @@ -46,7 +46,7 @@ qio_channel_websock_new_server(void *ioc, void *master) \"Websock new client ioc=\n>   qio_channel_websock_handshake_start(void *ioc) \"Websock handshake start ioc=%p\"\n>   qio_channel_websock_handshake_pending(void *ioc, int status) \"Websock handshake pending ioc=%p status=%d\"\n>   qio_channel_websock_handshake_reply(void *ioc) \"Websock handshake reply ioc=%p\"\n> -qio_channel_websock_handshake_fail(void *ioc) \"Websock handshake fail ioc=%p\"\n> +qio_channel_websock_handshake_fail(void *ioc, const char *msg) \"Websock handshake fail ioc=%p err=%s\"\n>   qio_channel_websock_handshake_complete(void *ioc) \"Websock handshake complete ioc=%p\"\n>   \n>   # io/channel-command.c\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"OwaO2bCX\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnWlb5PCpz9rxl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 04:07:55 +1000 (AEST)","from localhost ([::1]:37368 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpejx-0006bQ-Ks\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:07:53 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46596)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dpejE-0006Qa-E9\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:07:16 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dpej9-00081V-Fp\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:07:08 -0400","from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:36673)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dpej9-00080W-B2\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:07:03 -0400","by mail-qt0-x244.google.com with SMTP id 7so4345990qtz.3\n\tfor <qemu-devel@nongnu.org>; Wed, 06 Sep 2017 11:07:03 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tu58sm289911qtk.61.2017.09.06.11.07.00\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 06 Sep 2017 11:07:02 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=8295ZXx0oSXDsiZuZ71y6BGci5pwKvrP+pyh0MV+J2w=;\n\tb=OwaO2bCXXVi7uMhdqyTR8o5zecbWMPyjdLdeBARgFFX9PgC/mUdmryQDt9S3PZNsIT\n\txkRLnYMhai1U56W87+QxpMrUP4CuT0rBogRPCOKVOw7SLlTeczciP6FqZnJ6VI3s+Ei2\n\tJ3YAkjv4JSQyF+GrkG2lfh4kfrqqKQIICGaq0t4UPB/v/8F4kZpQQmRe3AdyPzeXlWBK\n\tfgot/VZS1SRT5yHIV/WwPNiq8LUj6lYFN0HkAaZ06Bb25qETUsR3Ro7sHUM4BU21TcOJ\n\tdPpk74bqXF+doGxM0SF/x6zP40CsvvEPJt2HzS5mTF0tsuxaTuyTrsBsuzRUKijLx08i\n\ttpow==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=8295ZXx0oSXDsiZuZ71y6BGci5pwKvrP+pyh0MV+J2w=;\n\tb=P2kFfepQ6uc+3UggCsKTOxIL1ae2f4NusbCZn/+g9gyjjfFDoCiOGMkgKCIhxGw9Gf\n\tMX5WP+8HqycXJx80upUJh5rmJJrpoNNLhl3CnbgxO59ZrhCClZaNIh2BuVElHxlFIZfe\n\tFCnjwEFdZ5GlHB7O9dPButdGCEAysK/hCFFC/sBowkq4g/eou86YGoX8jWW2C0g8PeR9\n\tXaUdhys7yy7H+7DUG4Kp8GMcP2JV0YbtftRfRVimL+k+PAz8XuHg10PFcQpwl0NqveMr\n\ttJ6VAL5AGhX0eL3HRyS/4X0qnRFMT6PYBZKYhvyrAAcXQQqmXrbICnGGfTV07Ub8u3z2\n\tq/0g==","X-Gm-Message-State":"AHPjjUgJMvaWkw/HYt5cT9nE0cpTh3qToaZaMXqsMZLOFoSAqhMO8NPe\n\tHNkVibey7QDHEA==","X-Google-Smtp-Source":"ADKCNb5Do314J4/ac+soU2QA/pTNVkLO2xswVNYtImNSNpqD3at0IVDgcbjKNfdAwaq1Wmtd0OrTqw==","X-Received":"by 10.200.34.207 with SMTP id g15mr44283qta.20.1504721222846;\n\tWed, 06 Sep 2017 11:07:02 -0700 (PDT)","To":"\"Daniel P. Berrange\" <berrange@redhat.com>, qemu-devel@nongnu.org","References":"<20170906104043.30745-1-berrange@redhat.com>\n\t<20170906104043.30745-3-berrange@redhat.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<0a4175fa-3586-d9ab-addb-736a17c24555@amsat.org>","Date":"Wed, 6 Sep 2017 15:06:59 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170906104043.30745-3-berrange@redhat.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::244","Subject":"Re: [Qemu-devel] [PATCH v1 2/2] io: include full error message in\n\twebsocket handshake trace","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Brian Rak <brak@vultr.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]