Skip to content

fix(core): use context timers for retry and recover default reqwest initialization - #9633

Merged
Xuanwo merged 5 commits into
mainfrom
xuanwo/opendal-060-reqwest-retry
Dec 4, 2026
Merged

Xuanwo merged 5 commits into
mainfrom
xuanwo/opendal-060-reqwest-retry

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #9548

Rationale for this change

RetryLayer's implicit Tokio timer can panic when an operation retries on a different runtime. During read recovery, a mutable "null" version can also be mistaken for a stable validator. Reqwest can panic when it builds the default client before the application installs a required Rustls provider.

What changes are included in this PR?

  • Use the operation executor for async retry backoff and retain it on open handles. The Java binding supplies timers from its Tokio runtime. When the executor supplies no timer for a scheduled retry, release the reservation and return ConfigInvalid with the triggering error as its source. Synchronous factory retries use blocking waits.
  • Treat empty and "null" read versions as absent so recovery uses the remaining validators. Matching strong ETags can support resumption.
  • Cache the default reqwest client after a successful build. Reqwest selects TLS using the features enabled across the application. For a native missing-provider panic, the configured panic hook runs. If the panic unwinds, the default transport and context.http.* client factory return ConfigInvalid. The same default transport can initialize after provider installation. A panic = "abort" build aborts if reqwest panics because the provider is missing.
  • Provide a Tokio executor in the Checksum, Foyer, and B2 retry tests so their operator contexts can schedule backoff and exercise the existing replay assertions.
  • Document that Compose is delegated to the service, which can determine whether each stage is safe to replay.
  • Restore locked dependency resolution for the standalone FIPS TLS example.

Are there any user-facing changes?

A public Operator::stat call recovered from a temporary failure with Compio outside Tokio. Java's public AsyncOperator.stat retried an HTTP 503 and returned the metadata from a second HEAD with both shared and dedicated executors. The default transport and context.http.* also work when a separate dependency enables reqwest's built-in provider. In a provider-free build with panic unwinding, the same default transport made a successful request after provider installation.

Breaking changes

Affected packages: core

Migration:

  • If RetryLayer previously used the implicit Tokio or browser timer, supply an executor that implements Execute::sleep through OperationContext::with_executor and Operator::with_context. For operators using the process-wide default, install a timer-capable executor with Executor::install_default. On Tokio, use opendal-executor-tokio with the time driver enabled.

AI Usage Statement

  • Pi via T3 Code, magpie/codex/gpt-6.2-astra, high effort. Traced the retry and transport contracts and proposed the acceptance cases.
  • Pi via T3 Code, magpie/codex/gpt-6.2-sol, max effort. Implemented and verified the changes, revised them after independent review, checked integration with main, and prepared this PR description. The native recovery path recognizes the missing-provider panic emitted by reqwest 0.13.4 and 0.13.5.
  • Pi via T3 Code, magpie/codex/gpt-6.2-sol, high effort. Independent reviewers reproduced the Java and downstream Cargo feature unification regressions in the first candidate, reconstructed the later integrated tree, and verified locked dependency resolution for the FIPS TLS example.
  • Pi via T3 Code, magpie/devin/swe-2-1, high effort. Independently verified Java retry timers, downstream TLS feature selection, and recovery after provider installation. Reviewed the main integration and CI repair, and reran all four affected tests on the signed candidate.

…nitialization

Return a configuration error for an unavailable async timer and retain the executor on open handles. Exclude placeholder versions from read recovery and document compose delegation.

Publish the shared default HTTP client to the cache after construction succeeds. Return a recoverable configuration error if provider-free Rustls needs a process provider.
Use the Java executor runtime for async backoff. Build reqwest clients with the resolved TLS features and translate only the known native missing-provider panic when unwinding is enabled. Preserve the configured panic hook and document the abort profile behavior.
The reqwest transport only depends on Rustls directly in its own tests. Remove the stale dependency edge from the downstream example so its documented locked Cargo invocation resolves again.
Checksum, Foyer, and B2 retry tests run on Tokio but need its timer in the operator context. Attach the existing Tokio executor adapter so each fixture reaches the same retry and replay assertions.
Preserve the Reqwest Rustls alias and provider recovery migration instructions. Resolve the checksum fixture import after main removed CapabilityCheckLayer.
@Xuanwo
Xuanwo merged commit d109696 into main Dec 4, 2026
117 of 118 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/opendal-060-reqwest-retry branch December 4, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(layers/retry,http-transports/reqwest): use OperationContext timer in RetryLayer, reject "null" version on resume, and avoid LazyLock poisoning

2 participants