Re: [netconf] RESTCONF error responses when streaming

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Wed, 17 June 2020 18:33 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 39F6B3A0C7A for <netconf@ietfa.amsl.com>; Wed, 17 Jun 2020 11:33:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IDi1zPpHO_QD for <netconf@ietfa.amsl.com>; Wed, 17 Jun 2020 11:33:06 -0700 (PDT)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 91C633A0C7D for <netconf@ietf.org>; Wed, 17 Jun 2020 11:33:06 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id F25B24C1; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.198]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id TvOF16dcjh7F; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "DFN-Verein Global Issuing CA" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by hermes.jacobs-university.de (Postfix) with ESMTP id A2364200E4; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10028) with ESMTP id tjw35xBXur5K; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
Received: from localhost (anna.jacobs.jacobs-university.de [10.50.218.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by hermes.jacobs-university.de (Postfix) with ESMTPS id 4739820154; Wed, 17 Jun 2020 20:33:04 +0200 (CEST)
Date: Wed, 17 Jun 2020 20:33:03 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: "Jan Lindblad (jlindbla)" <jlindbla=40cisco.com@dmarc.ietf.org>
Cc: "netconf@ietf.org" <netconf@ietf.org>
Message-ID: <20200617183303.cicdrblkqyx3pgew@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: "Jan Lindblad (jlindbla)" <jlindbla=40cisco.com@dmarc.ietf.org>, "netconf@ietf.org" <netconf@ietf.org>
References: <681EC915-A2E8-4806-BD12-5B9D482549E5@cisco.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <681EC915-A2E8-4806-BD12-5B9D482549E5@cisco.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/JgIefpbHHmt7B_KSlZvInJSiaI4>
Subject: Re: [netconf] RESTCONF error responses when streaming
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jun 2020 18:33:09 -0000

It should be standard HTTP behaviour and the best bet likely is to
simply close the connection. If you use chunked encoding, then the
response is known to be incomplete. It seems wrong to try to handle
this situation with special error tags that are RESTCONF specific
since this problem is not RESTCONF specific.

/js

On Wed, Jun 17, 2020 at 06:16:44PM +0000, Jan Lindblad (jlindbla) wrote:
> Hi all,
> 
> RFC 8040 has some nice examples of RESTCONF requests that return errors, i.e. invalid-value 400, access-denied 403, in-use 409, etc. But what if the server streams/pipes the output back to the client, and everything looks fine to begin with? 
> 
> Let's say the client does a GET /restconf/data/example-jukebox:jukebox/library . In our example here, the library is huge, so the implementation streams back the responses. Half way through, the database chokes on something and shuts down. It's now too late to return operation-failed 412, since the status code is returned in the response header.
> 
> Which of the following alternatives best describes the behaviour that the RESTCONF server should implement in the above situation?
> 
> a) Simply close the client connection
> b) Return a <nc:errors> tag right where the problem is detected, xmlns:nc="urn:ietf:params:xml:ns:yang:ietf-restconf" (assuming XML media type)
> b2) Return a "ietf-restconf:errors" tag right where the problem is detected (assuming JSON media type)
> c) Provide closing tags/brackets to return to the "top level", then return a <nc:errors>/"ietf-restconf:errors" blurb
> d) None of the above
> e) No valid reply exists
> 
> Looking for general REST answers to this problem, it looks like some people have created a mime-multipart message encoding which allows status codes to be sent in a follow up mime part. Would anything like that be usable in a situation like this?
> https://stackoverflow.com/questions/56980068/when-to-write-headers-for-a-streaming-response
> 
> Best Regards,
> /jan
> 
> _______________________________________________
> netconf mailing list
> netconf@ietf.org
> https://www.ietf.org/mailman/listinfo/netconf

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>