if-modified-since: <last-modified> on SLO returns 304 on HEAD, but 500 on GET

Bug #2040178 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Unassigned

Bug Description

When making a well formated If-Modified-Since conditional header with GET on an SLO object (a reasonable use-case, that works with regular objects and DLO manifests see lp bug#1280022) - a client can reliably trigger a 500 Server Error:

# regular object
vagrant@saio:~$ swift stat -v test test
                   URL: https://saio/v1/AUTH_test/test/test
            Auth Token: AUTH_tk37daf2703ece4a8c8445343a6caefc64
               Account: AUTH_test
             Container: test
                Object: test
          Content Type: application/octet-stream
        Content Length: 8
         Last Modified: Mon, 23 Oct 2023 17:02:38 GMT
                  ETag: "70c1db56f301c9e337b0099bd4174b28"
            Meta Mtime: 1695270479.156160
           X-Timestamp: 1698080557.43293
         Accept-Ranges: bytes
            X-Trans-Id: tx57e27b4211e0484784b0d-006536a7df
X-Openstack-Request-Id: tx57e27b4211e0484784b0d-006536a7df
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test -H 'if-modified-since: Mon, 23 Oct 2023 17:02:38 GMT' -I
HTTP/1.1 304 Not Modified
Content-Type: application/octet-stream
X-Object-Meta-Mtime: 1695270479.156160
Etag: "70c1db56f301c9e337b0099bd4174b28"
Last-Modified: Mon, 23 Oct 2023 17:02:38 GMT
X-Timestamp: 1698080557.43293
Accept-Ranges: bytes
Content-Length: 0
X-Trans-Id: tx3c785d18b4a642a5ae98b-006536a7e7
X-Openstack-Request-Id: tx3c785d18b4a642a5ae98b-006536a7e7
Date: Mon, 23 Oct 2023 17:05:43 GMT

vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test -H 'if-modified-since: Mon, 23 Oct 2023 17:02:38 GMT' -I -XGET
HTTP/1.1 304 Not Modified
Content-Type: application/octet-stream
X-Object-Meta-Mtime: 1695270479.156160
Etag: "70c1db56f301c9e337b0099bd4174b28"
Last-Modified: Mon, 23 Oct 2023 17:02:38 GMT
X-Timestamp: 1698080557.43293
Accept-Ranges: bytes
Content-Length: 0
X-Trans-Id: tx5429f8bfcb4e44c5906f3-006536a7ed
X-Openstack-Request-Id: tx5429f8bfcb4e44c5906f3-006536a7ed
Date: Mon, 23 Oct 2023 17:05:49 GMT

# DLO manifest
vagrant@saio:~$ swift stat -v test test.dlo
                   URL: https://saio/v1/AUTH_test/test/test.dlo
            Auth Token: AUTH_tk37daf2703ece4a8c8445343a6caefc64
               Account: AUTH_test
             Container: test
                Object: test.dlo
          Content Type: application/octet-stream
        Content Length: 10485760
         Last Modified: Mon, 23 Oct 2023 17:03:49 GMT
                  ETag: "71e938d37c1d06dc634dd24660255a88"
              Manifest: test_segments/test.dlo/1698076626.622360/10485760/1000000/
            Meta Mtime: 1698076626.622360
           X-Timestamp: 1698080628.31794
         Accept-Ranges: bytes
            X-Trans-Id: tx3a4533bb1bce4b6a92d3e-006536a7f2
X-Openstack-Request-Id: tx3a4533bb1bce4b6a92d3e-006536a7f2
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test.dlo -H 'if-modified-since: Mon, 23 Oct 2023 17:03:49 GMT' -I
HTTP/1.1 304 Not Modified
Content-Type: application/octet-stream
X-Object-Meta-Mtime: 1698076626.622360
X-Object-Manifest: test_segments/test.dlo/1698076626.622360/10485760/1000000/
Last-Modified: Mon, 23 Oct 2023 17:03:49 GMT
X-Timestamp: 1698080628.31794
Accept-Ranges: bytes
Content-Length: 0
Etag: "71e938d37c1d06dc634dd24660255a88"
X-Trans-Id: txa7738e4a56564b07a72b5-006536a803
X-Openstack-Request-Id: txa7738e4a56564b07a72b5-006536a803
Date: Mon, 23 Oct 2023 17:06:11 GMT

vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test.dlo -H 'if-modified-since: Mon, 23 Oct 2023 17:03:49 GMT' -I -XGET
HTTP/1.1 304 Not Modified
Content-Type: application/octet-stream
X-Object-Meta-Mtime: 1698076626.622360
X-Object-Manifest: test_segments/test.dlo/1698076626.622360/10485760/1000000/
Last-Modified: Mon, 23 Oct 2023 17:03:49 GMT
X-Timestamp: 1698080628.31794
Accept-Ranges: bytes
Content-Length: 0
Etag: "71e938d37c1d06dc634dd24660255a88"
X-Trans-Id: tx3de8cf0047fb48d291df2-006536a806
X-Openstack-Request-Id: tx3de8cf0047fb48d291df2-006536a806
Date: Mon, 23 Oct 2023 17:06:14 GMT

# SLO Manifest
vagrant@saio:~$ swift stat -v test test.big
                   URL: https://saio/v1/AUTH_test/test/test.big
            Auth Token: AUTH_tk37daf2703ece4a8c8445343a6caefc64
               Account: AUTH_test
             Container: test
                Object: test.big
          Content Type: application/octet-stream
        Content Length: 10485760
         Last Modified: Mon, 23 Oct 2023 15:57:13 GMT
                  ETag: "71e938d37c1d06dc634dd24660255a88"
            Meta Mtime: 1698076626.622360
 X-Static-Large-Object: True
           X-Timestamp: 1698076632.97986
         Accept-Ranges: bytes
       X-Manifest-Etag: 89a14c33224fd28d5d4dfbac8248deb6
            X-Trans-Id: tx9fcf4ab512264c3797df8-006536a811
X-Openstack-Request-Id: tx9fcf4ab512264c3797df8-006536a811
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test.big -H 'if-modified-since: Mon, 23 Oct 2023 15:57:13 GMT' -I
HTTP/1.1 304 Not Modified
Content-Type: application/octet-stream
Content-Length: 0
X-Object-Meta-Mtime: 1698076626.622360
X-Static-Large-Object: True
Etag: "71e938d37c1d06dc634dd24660255a88"
Last-Modified: Mon, 23 Oct 2023 15:57:13 GMT
X-Timestamp: 1698076632.97986
Accept-Ranges: bytes
X-Manifest-Etag: 89a14c33224fd28d5d4dfbac8248deb6
X-Trans-Id: txc7cba1115c654b95823e0-006536a827
X-Openstack-Request-Id: txc7cba1115c654b95823e0-006536a827
Date: Mon, 23 Oct 2023 17:06:47 GMT

vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk37daf2703ece4a8c8445343a6caefc64' https://saio/v1/AUTH_test/test/test.big -H 'if-modified-since: Mon, 23 Oct 2023 15:57:13 GMT' -I -XGET
HTTP/1.1 500 Internal Error
Content-Type: text/html; charset=UTF-8
Content-Length: 27
X-Trans-Id: txe40435f65c9a49fcb9566-006536a82b
X-Openstack-Request-Id: txe40435f65c9a49fcb9566-006536a82b
Date: Mon, 23 Oct 2023 17:06:51 GMT

N.B. SLO will return the expected 304 response, but only for HEADs

Unittesting suggests the server error can present with If-Unmodified-Since requests, as well as manifests stored w/o slo_etag/slo_size sysmeta.

Tags: slo
clayg (clay-gerrard)
summary: - if-modified-since: <last-modified> of SLO returns 304 on HEAD, but 500
+ if-modified-since: <last-modified> on SLO returns 304 on HEAD, but 500
on GET
Changed in swift:
status: New → In Progress
Tim Burke (1-tim-z)
tags: added: slo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to swift (master)

Reviewed: https://review.opendev.org/c/openstack/swift/+/896466
Committed: https://opendev.org/openstack/swift/commit/3dab88bdf83eba339cd1a2d391b9e421ff2c5cf0
Submitter: "Zuul (22348)"
Branch: master

commit 3dab88bdf83eba339cd1a2d391b9e421ff2c5cf0
Author: Clay Gerrard <email address hidden>
Date: Fri Sep 22 14:48:41 2023 -0500

    tests: refactor SLO size/etag sysmeta tests

    We've been writing SLO manifests with size/etag sysmeta for more than 5
    years, but we want our tests and code to continue to support the legacy
    format forever. This test infra refactor will make that easier for test
    authors to opt-in testing of legacy manifests by reusing a common
    pattern for manifest setup across tests.

    This consolidation also cleans up some duplication where two TestCases
    had identical manifest setup and paves the way to more tidying of
    similar (but slightly different) manifest setup across TestCases and
    sharing of setup across future TestCases.

    This manifest setup standardization also adopts a consistent naming
    scheme for manifest sysmeta values so test assertions are easier to read
    as correct at a glance (e.g. slo_etag vs json_md5)

    Additionally leak tracking is added to the common base; SLO was already
    really good about *closing* requests, but in many cases seems to not
    bother reading/draining them (even when they might be empty/small).

    As part of the leak tracking investigation a couple new tests were added
    to explore the behavior of SLO's SegmentedIterable in the
    request_helpers module.

    Drive-By: Fix SegmentedIterable docstring: the constructor has
    expected an iterable yielding dicts, not tuples, since the
    Related-Change [2].

    Drive-By: remove FakeSwift's now unused "register_responses" interface
    and provide "register_next_response" as a replacment. This allows test
    authors to extend the registered response for a given request key from a
    common test setup into a "series of registered responses" by expressing
    just the new/next response rather than forcing them to duplicate the
    initial response in the explicit list passed to "register_responses".

    Related-Bug: #2040178
    Co-Authored-By: Alistair Coles <email address hidden>
    [1] Related-Change: Ia6ad32354105515560b005cea750aa64a88c96f9
    [2] Related-Change-Id: Ib8dc216a84d370e6da7d6b819af79582b671d699
    Change-Id: I54094f3d2098f56b755ec19cc9315d06a6ca8b15

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.opendev.org/c/openstack/swift/+/893578
Committed: https://opendev.org/openstack/swift/commit/4a37a2976bb0f1ff5c6fd20800887e1e848c9bea
Submitter: "Zuul (22348)"
Branch: master

commit 4a37a2976bb0f1ff5c6fd20800887e1e848c9bea
Author: Clay Gerrard <email address hidden>
Date: Wed Oct 11 09:33:46 2023 -0500

    slo: refactor GET/HEAD response handling

    This patch reorganizes the SLO read response handling. The main goal
    was to push the response header replacement for both GET/HEAD SLO and
    multipart-manifest=get paths all into a common return path. A new
    RespAttrs primitive is used to carry around some metadata details from
    requests made in SLO. The authors hope these changes make the code more
    easily readable and easier to modify.

    Drive-By: add new "friendly_close" function in common.utils so we can
    drain empty/error responses more confidently (and use it in swob and
    request_helpers).

    Drive-By: the tests added in the Related-Change discovered a 500 on
    If-[Un]Modified-Since conditional GET requests - it probably wasn't
    important, but this refactor fixed it on accident as a side effect.

    Closes-Bug: #2040178
    Co-Authored-By: Alistair Coles <email address hidden>
    Co-Authored-By: Ashwin Nair <email address hidden>
    Related-Change-Id: I54094f3d2098f56b755ec19cc9315d06a6ca8b15
    Change-Id: Idc84e70539fc7480b6ecb86e2f0da904baf2c727

Changed in swift:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.33.0

This issue was fixed in the openstack/swift 2.33.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.