[netconf] RESTCONF error responses when streaming

"Jan Lindblad (jlindbla)" <jlindbla@cisco.com> Wed, 17 June 2020 18:16 UTC

Return-Path: <jlindbla@cisco.com>
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 201633A0AD6 for <netconf@ietfa.amsl.com>; Wed, 17 Jun 2020 11:16:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.598
X-Spam-Level:
X-Spam-Status: No, score=-9.598 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=JcZZtel4; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=DOhKeRQh
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 H8NUn4HSOk-H for <netconf@ietfa.amsl.com>; Wed, 17 Jun 2020 11:16:48 -0700 (PDT)
Received: from rcdn-iport-3.cisco.com (rcdn-iport-3.cisco.com [173.37.86.74]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6E4E63A0AD5 for <netconf@ietf.org>; Wed, 17 Jun 2020 11:16:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1612; q=dns/txt; s=iport; t=1592417808; x=1593627408; h=from:to:subject:date:message-id:content-id: content-transfer-encoding:mime-version; bh=dD9IxM83fIS/WIlRYRoqwcIttpUaX/i/oaVCFVnqtew=; b=JcZZtel4/2n4AmLKXdDSmsXKjglNoe51e55felOVgB8C/gD30N3tjDlX WMTVx2RICRq7JzyzI2KJJfwdqff22j9s3xHx/mbc3Xegr7oAzpj9La3r3 oH+w6ly6pItDiYjXRxCiQM5vIBtzpSrv4YCh4u3B8ULNu/tTXL6E2rIPj 4=;
IronPort-PHdr: =?us-ascii?q?9a23=3ATIXOWhzvmEmGwhzXCy+N+z0EezQntrPoPwUc9p?= =?us-ascii?q?sgjfdUf7+++4j5ZRWFt/RgkFGPWp/UuLpIiOvT5qbnX2FIoZOMq2sLf5EEUR?= =?us-ascii?q?gZwd4XkAotDI/gawX7IffmYjZ8EJFEU1lorHC2LUYTH9zxNBXep3So5msUHR?= =?us-ascii?q?PyfQN+OuXyHNvUiMK6n+C/8pHeeUNGnj24NLhzNx6x6w7Ws5ob?=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CRDADXXOpe/5BdJa1mHgE8DAILFYM?= =?us-ascii?q?cUQdvWC8sCodgA40amHeCUgNVCwEBAQwBASUIAgQBAYZgAiQ4EwIDAQELAQE?= =?us-ascii?q?FAQEBAgEGBG2FWwELhgsoBgEBOBEBPkInBDWDBAGCSwMuAQMLrDYCgTmIYXS?= =?us-ascii?q?BNIMBAQEFgTIBFg9xgnIYgg4DBoE4gmeJeBqBQT+BOAwQgk2EY4Nfgi2PBAu?= =?us-ascii?q?MW5hjCoJaiECQYQMdnm6RI4oQlCkCBAIEBQIOAQEFgWoiQ4ETcBVlAYI+UBc?= =?us-ascii?q?CDZIPilZ0NwIGCAEBAwl8jwABgRABAQ?=
X-IronPort-AV: E=Sophos;i="5.73,523,1583193600"; d="scan'208";a="768818511"
Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 17 Jun 2020 18:16:47 +0000
Received: from XCH-ALN-004.cisco.com (xch-aln-004.cisco.com [173.36.7.14]) by rcdn-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id 05HIGkeP020366 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL) for <netconf@ietf.org>; Wed, 17 Jun 2020 18:16:47 GMT
Received: from xhs-rtp-002.cisco.com (64.101.210.229) by XCH-ALN-004.cisco.com (173.36.7.14) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Jun 2020 13:16:46 -0500
Received: from xhs-rtp-001.cisco.com (64.101.210.228) by xhs-rtp-002.cisco.com (64.101.210.229) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Jun 2020 14:16:45 -0400
Received: from NAM11-DM6-obe.outbound.protection.outlook.com (64.101.32.56) by xhs-rtp-001.cisco.com (64.101.210.228) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 17 Jun 2020 14:16:45 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RdFUWDDpsMDC8D5NECcUdtWcPryYIJQoMwpCWVxk5YBe7R9QM+AMr0GSERjU+nWEWZL+WtIpVgVfLsMYHnQplN6rJvrMVvqfHzPvnSOZtRj9E2tjPNk61SGlLyWJNO2gs5crjFPoF6JxSfj4pMireUQHJdF+yTa/lMUI8zpnszChtlTiwIe5fRUd+FV8Dgu97GGGxTQT2irJTlpe9f8Dw/Yvs8aw27myO0q7XycKfxANNfDzIRSsWqcbRU71D9INY7FkipDLmIBE7wvZCeHJ1dROH8+1yRlJzbCmSf5EXpe6jWOTiX84eWsPlMo026NjuaDmnv2T65hHpNFwkT9tOg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dD9IxM83fIS/WIlRYRoqwcIttpUaX/i/oaVCFVnqtew=; b=ZbISWMxnZnVhfOZo5vaBNePy3iokpl0foU6ZySmKsY5IVJvNwPi3dsy2KwR7qkrF5WKPHDQNY1PvsvErDk3BDMjGOYHhIuswOHPkab/+2f2y/wVK9t2SJOuBpuWoLxsC0la5IuSCvLXJ0dpBlYhDln2fCqTQNH4BZ16NsaksXCblB/VU+xV4wOurzcr7412VB0PQaVZk1m2GZJKmZlaC5nD4FmduTRqbA4hPGbCPXK4Eh0urAuDscsJ+n9kW3TaaKNbl1sVi5vxbzneCAGZXSbwIatwDdUn4+gS9sMDn328oA3zeB18pGfXlup0UY72bxT8FV5U+GR3BHTqAWMKrwQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dD9IxM83fIS/WIlRYRoqwcIttpUaX/i/oaVCFVnqtew=; b=DOhKeRQhhV4zv4hfl6i9IOrAnOaEXgKMTkhrgjBO1zbT0XoOa9d/Pnq+8FRf1SACLKmjeOq30lsrLlDDjOABIr+trS3Uc/gVSxplWRhjkO+5NDSdjfLUHer0S+jqdWGaU1htUbOZ44xLCqcxPeXAhg1iNwZ89fCl9iToFD1b+PM=
Received: from DM6PR11MB2841.namprd11.prod.outlook.com (2603:10b6:5:c8::32) by DM6PR11MB3676.namprd11.prod.outlook.com (2603:10b6:5:137::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Wed, 17 Jun 2020 18:16:44 +0000
Received: from DM6PR11MB2841.namprd11.prod.outlook.com ([fe80::e903:7b03:4757:bcc2]) by DM6PR11MB2841.namprd11.prod.outlook.com ([fe80::e903:7b03:4757:bcc2%4]) with mapi id 15.20.3109.021; Wed, 17 Jun 2020 18:16:44 +0000
From: "Jan Lindblad (jlindbla)" <jlindbla@cisco.com>
To: "netconf@ietf.org" <netconf@ietf.org>
Thread-Topic: RESTCONF error responses when streaming
Thread-Index: AQHWRNN0JYZvVqk3OUy9aZDOPyhBOA==
Date: Wed, 17 Jun 2020 18:16:44 +0000
Message-ID: <681EC915-A2E8-4806-BD12-5B9D482549E5@cisco.com>
Accept-Language: sv-SE, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: ietf.org; dkim=none (message not signed) header.d=none;ietf.org; dmarc=none action=none header.from=cisco.com;
x-originating-ip: [213.67.237.150]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 6bfbd229-1bd4-4629-a5c3-08d812ea975d
x-ms-traffictypediagnostic: DM6PR11MB3676:
x-microsoft-antispam-prvs: <DM6PR11MB3676AB3C7130C94CADF27019CA9A0@DM6PR11MB3676.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:6430;
x-forefront-prvs: 04371797A5
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: A6oLBLorJA1yqfURk1/y87K5Bg0ZnA4rT4AthDlZQ23swwsgUdnkG804IKuPBQej2b1rogkEaJT2vcc6CKCOTj3pFUJwmlE1z0hgrWW6pnD/AGFH29/aGkWdqW73Dhb/aBnCRHubkvisOPrOD3XVLuNXZMtlohRpFKugHmkW2Xm2nMcWqWJ5pP/urRhTyDzOiQdmhl06YLYOamXU3awdatP7OJG3Vin1p9rD6rc4E79J4mFbqHYvyFBKPw4Mttn4lbF+Q/Yke+952tlm2lf1tERSN5r34Svtplgfxy3y69UgxR/C3qu1f4p1l3VIOCTDEI3h87K0WElNzcXcmC1KEfOu+/y2DIj6aiwGYt9DgbJE6jG70Qk1Kd8wdOMZCAI6z5m26KVxKRFrjfnDEA12uw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2841.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(346002)(39860400002)(136003)(376002)(66946007)(66476007)(64756008)(36756003)(2906002)(8936002)(8676002)(478600001)(966005)(76116006)(86362001)(66446008)(91956017)(66556008)(6486002)(83380400001)(6512007)(2616005)(71200400001)(5660300002)(33656002)(6916009)(6506007)(186003)(316002)(26005); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata: KPDXH5mpaTp1jPxUXREaMKzlYXpUQRzoC/TfThJm3a6DLN3RrdktLzB7INfjx8E+AcxsDAvnaL/XZshQnqUEYfOOHdwlI9YI28u0IKugsBEh+c6ysSsBFyaLl6A6jJ1mf5Td3jWx1yP05dGUzbzKHFZFHy2o9pLO2RSnNJ7MS66ZRiEb+SXdfTMNePdistosVZZc41fnOypHzUn4eqnAKlJy45VISl1qpGjxtVZ3IGHa1xqy5+FjLLg90Xd9hl+0sSPfV5GOQoJTB61HeGKQtGjztMkHOd24hJdnMJnsvUD8zwQxAiF3nZs3pfz69fylaVbZMjtpch+ClsoaSDnEhj0OqKA+RrL1vPSwHZd2MubLGzpUr6W9gDzZD6TOizI0atL9BEqLupXtW6n2F0iTvckbLFbsqZm7BkfzpFfKUuViAt32PWswSBTTttRx3Hw4QLx3Gx1qAGwaPjC8nGsbf8MBuARvRbH+VHFwvvXaw8FX8pbcRTLBKL2mZQO6Us1e
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6E7C769BC22D7A4EB7AC2D12CCE26259@namprd11.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 6bfbd229-1bd4-4629-a5c3-08d812ea975d
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jun 2020 18:16:44.3779 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: qQ6rKSPfkZ4lPXqwJ19LxDHjR6rzvDVdyoUyjJvMgNDSrj76DsIVBV+4vYBPqz/pXGTwFDLFSDTFoFFBDVRHJw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3676
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.36.7.14, xch-aln-004.cisco.com
X-Outbound-Node: rcdn-core-8.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/d1TZ5m_hkpCdpufn3Qdx_sf8k_M>
Subject: [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:16:50 -0000

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