Xuanwo opened a new pull request, #8737:
URL: https://github.com/apache/opendal/pull/8737
# Which issue does this PR close?
This PR fixes an unbounded, zero-backoff retry loop found during
maintenance; no issue was filed for it.
# Rationale for this change
`MultipartCopier` and `BlockCopier` (`core/core/src/raw/oio/copy/`) caught
temporary errors from `ConcurrentTasks::execute` and `ConcurrentTasks::next`
inside unconditional `loop`s with no retry budget and no backoff:
```rust
loop {
match self.tasks.execute(input.clone()).await {
Ok(()) => break,
Err(err) if err.is_temporary() => continue, // spin, no backoff
Err(err) => return Err(err),
}
}
```
`RetryLayer` already wraps `oio::Copy::{next, close, abort}` with backoff,
so this internal loop bypassed the layer entirely. If `copy_part` /
`copy_block` kept failing temporarily — a persistent `503 SlowDown`, a broken
network, or the executor's own "copy part timeout" error — `oio::Copy::next()`
hung forever while hammering the backend in a tight loop.
`MultipartWriter` and `BlockWriter` already handle this correctly: they
propagate task errors to the caller, and `ConcurrentTasks` preserves retryable
state by keeping the failed task's input in the queue and respawning it in
place. The copiers now do the same.
# What changes are included in this PR?
- `fill_tasks` in both copiers propagates `tasks.execute()` errors instead
of looping on temporary ones. Inputs not yet scheduled are rebuilt from
`next_offset` on the retried `next()` call, so no range is lost or duplicated.
- `next()` propagates `tasks.next()` errors (via `transpose()?`) instead of
`continue`-ing. A failed task stays queued in `ConcurrentTasks` and is retried
by the caller's retry of `next()` / `close()`.
- `MultipartCopier::abort` keeps `upload_id` until `abort_copy` succeeds, so
a retried `abort()` can still cancel the same multipart copy instead of
reporting success while leaking it.
- Dropped the now-unused `Clone` impls for the copy-task inputs.
- Added deterministic unit tests:
- A `copy_part` / `copy_block` that always fails temporarily returns an
error from `next()` immediately (within a 10s timeout) instead of hanging.
- A `copy_part` / `copy_block` that fails once temporarily and is retried
(as `RetryLayer` does) completes the copy with all parts/blocks in exact source
order and no duplicates or drops.
Note: `core/services/gcs/src/composer.rs` has the same zero-backoff
`continue` pattern, but `oio::Compose` is not wrapped by `RetryLayer` (`type
Composer = oio::Composer`), so its internal loop is the only retry mechanism
today. Changing it requires a different design and is left for a follow-up.
# Are there any user-facing changes?
Yes, behavior fix: `Operator::copy` / `Copier` on services using multipart
copy (s3, tos) or block copy (azblob) now surface persistent temporary
copy-part failures to `RetryLayer` instead of hanging the operation and
hammering the backend in a zero-backoff loop.
# Breaking changes
# AI Usage Statement
- Harness: pi coding agent inside T3 Code
- Model: Claude Opus 4.6
- Effort: default
- Role: Located the defect by comparing the copiers against the writer
implementations and `ConcurrentTasks`/`RetryLayer` semantics, implemented the
fix and tests, and ran local verification. Unknown: the GCS composer shares a
similar zero-backoff loop but is not retry-wrapped, so it was intentionally
left unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]