Retry loop retries 501 Not Implemented

Open Beginner friendly
#914 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
networking

Research direction

The default retry predicate is in src/client/retry.rs in RetryableRequest, where any server-error status is retried. Find that check and see how it treats 501 Not Implemented compared with other 5xx codes. Done means a 501 response is returned to the caller on the first attempt without retries, while other 5xx responses are still retried. Check the existing retry tests to confirm nothing else changes.

Written by the indexing model from the issue text.

Description

Describe the bug

RetryableRequest retries any 5xx response (status.is_server_error(), src/client/retry.rs around line 428 on main, 406-411 in 0.14.2). That includes 501 Not Implemented, which RFC 9110 section 15.6.2 defines as "the server does not support the functionality required to fulfill the request": the same request will get the same answer. With the default RetryConfig the caller waits through 10 retries with backoff (seconds typically, up to retry_timeout) before getting the error it could have had at once.

To Reproduce

A server or CDN that does not implement a request feature answers 501. For example, Fastly answers a suffix range (Range: bytes=-n) with 501. Against an S3-compatible endpoint that does this, store.get_opts(path, GetOptions { range: Some(GetRange::Suffix(n)), .. }) sends the request 11 times and then fails with ... after 10 retries, max_retries: 10, retry_timeout: 180s ... 501 Not Implemented.

Expected behavior

A 501 is returned to the caller on the first response, without retrying, so the caller can fall back (for a suffix range: ask for a bounded range instead).

Additional context

  • A one-line change in the default predicate would do it: retry is_server_error() && status != StatusCode::NOT_IMPLEMENTED.
  • #840 / #841 would let a caller override the whole status predicate; this is narrower: only the default's handling of 501.
  • Workaround today: wrap the HttpConnector and map a 501 response to an HttpError of kind Unknown, which the retry loop does not retry.
Dominant language
Rust
Stars
339
Forks
240
Avg merge
1d 13h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-rs-object-store

All issues in apache/arrow-rs-object-store

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.