Skip to content

[BUG] Retry-After beyond max_backoff stalls the curl retry queue and HttpClient shutdown #4631

Description

@ThomsonTan

Describe your environment

  • The affected code shipped in v1.29.0, the first release with [OTLP/HTTP] Honor Retry-After header when retrying exports  #4186.
  • Retry support on, which is the CMake default: OTELCPP_WITH_OTLP_RETRY_PREVIEW=ON defines ENABLE_OTLP_RETRY_PREVIEW.
  • Reproduced on Windows with MSVC 14.44 (Visual Studio 2022) and libcurl 8.21.0-DEV, by compiling the curl client sources with ENABLE_OTLP_RETRY_PREVIEW defined. The code involved is not platform specific.

Steps to reproduce

  1. Run an HTTP server with two endpoints:
    • POST /slow answers 429 Too Many Requests with Retry-After: 8.
    • POST /busy answers 503 the first time and 200 after that.
  2. Create one opentelemetry::ext::http::client::curl::HttpClient. Give every request RetryPolicy{5, SecondsDecimal{0.2f}, SecondsDecimal{1.0f}, 1.5f}, so max_backoff (1 s) is below the server's Retry-After (8 s). The OTLP/HTTP exporters default to a 5 s max_backoff.
  3. Send a request to /slow and wait for its handler. The handler gets the 429 immediately and the server sees one request, so the session was closed rather than retried, as intended.
  4. Then do one of the following:
    • call WaitBackgroundThreadExit() right away, or
    • send a request to /busy and time how long its retry takes.

What is the expected behavior?

The session closed because of its Retry-After should not go into the retry queue. WaitBackgroundThreadExit() and ~HttpClient() should return promptly. The /busy retry should follow its own backoff, which takes about 0.26 s here when nothing is ahead of it in the queue.

What is the actual behavior?

  • WaitBackgroundThreadExit() returned after 8000 ms and used 7.8 s of CPU while waiting.
  • The /busy retry happened after 8.2 s instead of about 0.26 s.

Additional context
Add any other context about the problem here.

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions