bug(layers/retry): concurrent multipart parts share one retry count per writer call
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Start by reading RetryLayer in core/layers/retry and the concurrent multipart/task handling under core/core/src/raw. Run the provided fake S3 server and Rust reproducer to confirm that multiple parts failed in one write or close call share one retry count. Done means each concurrent part receives its own max_times retries, including the four-part concurrent case, while the single-concurrency behavior remains successful.
索引モデルが issue の本文から書いたものです。
説明
OpenDAL version or commit
ce0712c (also seen on 883d1da)
Affected service or component
RetryLayer (core/layers/retry) with oio::MultipartWriter and ConcurrentTasks (core/core/src/raw). Seen with services-s3.
Describe the bug
RetryLayer counts retries for each call of Writer::write or Writer::close, not for each part. A concurrent MultipartWriter returns the temporary error of each failed part from the call that collects the part. ConcurrentTasks respawns the failed part, and RetryWrapper retries the call. The next failed part then uses the next retry of the same call.
So the write fails when one call collects more than max_times failed parts, although each part needs only one retry. One burst of 503 SlowDown on all parts in flight at close is enough.
With concurrent = 1, the same failures succeed: each part runs inside its own write call, and each call has its own retries.
Steps to Reproduce
- Start a fake S3 endpoint that answers the first
UploadPartfor each part number with503:python3 fake_s3.py 19777
"""Fake S3 multipart endpoint: the first UploadPart for each part number gets a 503."""
import sys
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlsplit
seen = set()
class Handler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
def reply(self, status, body=b"", headers=()):
self.send_response(status)
for key, value in headers:
self.send_header(key, value)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def read_body(self):
length = int(self.headers.get("Content-Length", "0"))
if length:
self.rfile.read(length)
def do_POST(self):
self.read_body()
query = parse_qs(urlsplit(self.path).query, keep_blank_values=True)
if "uploads" in query:
body = b"<InitiateMultipartUploadResult><UploadId>u1</UploadId></InitiateMultipartUploadResult>"
else:
body = b'<CompleteMultipartUploadResult><ETag>"done"</ETag></CompleteMultipartUploadResult>'
self.reply(200, body)
def do_PUT(self):
self.read_body()
query = parse_qs(urlsplit(self.path).query)
key = (urlsplit(self.path).path, query.get("partNumber", [""])[0])
if "partNumber" in query and key not in seen:
seen.add(key)
print(f"503 part {key}", flush=True)
self.reply(503, b"<Error><Code>ServiceUnavailable</Code></Error>")
return
self.reply(200, headers=[("ETag", '"etag"')])
def do_DELETE(self):
self.reply(204)
def log_message(self, *_args):
pass
ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), Handler).serve_forever()
- Run this program with
cargo run -- http://127.0.0.1:19777.Cargo.toml:opendal = { git = "https://github.com/apache/opendal.git", rev = "ce0712c", features = ["services-s3"] }andtokio = { version = "1", features = ["rt-multi-thread", "macros"] }.
use std::time::Duration;
use opendal::layers::RetryLayer;
use opendal::services::S3;
use opendal::Operator;
const PART: usize = 5 * 1024 * 1024;
#[tokio::main]
async fn main() -> opendal::Result<()> {
let endpoint = std::env::args().nth(1).expect("endpoint");
let op = Operator::new(
S3::default()
.bucket("bucket")
.region("us-east-1")
.endpoint(&endpoint)
.access_key_id("key")
.secret_access_key("secret")
.disable_config_load()
.disable_ec2_metadata(),
)?
.layer(
RetryLayer::new()
.with_max_times(3)
.with_min_delay(Duration::from_millis(10)),
);
// Each part fails once with a 503, so each part needs one retry.
for (concurrent, parts) in [(4, 3), (4, 4), (1, 4)] {
let path = format!("concurrent{concurrent}-parts{parts}");
let mut writer = op
.writer_with(&path)
.chunk(PART)
.concurrent(concurrent)
.await?;
for _ in 0..parts {
writer.write(vec![0u8; PART]).await?;
}
match writer.close().await {
Ok(_) => println!("concurrent={concurrent} parts={parts}: close ok"),
Err(err) => println!("concurrent={concurrent} parts={parts}: close failed: {err}"),
}
}
Ok(())
}
Actual Behavior
concurrent=4 parts=3: close ok
concurrent=4 parts=4: close failed: Unexpected (persistent) at write, context: { service_operation: UploadPart, uri: http://127.0.0.1:19777/bucket/concurrent4-parts4?partNumber=4&uploadId=u1, response: Parts { status: 503, ... }, service: s3, path: concurrent4-parts4, ... }
concurrent=1 parts=4: close ok
The server answered one 503 for each part of concurrent4-parts4. Each part succeeded on its second attempt, except part 4, which got no second attempt.
Expected Behavior
Each part gets max_times retries, as with concurrent = 1. A write in which no part fails more than max_times times succeeds for any concurrent value.
Additional Context
- #8737 describes the design: a failed task "stays queued in
ConcurrentTasksand is retried by the caller's retry ofnext()/close()". After that change,MultipartCopierandBlockCopieruse the same path, so they probably share the count in the same way. I did not test the copiers. - I also reproduced this with MinIO behind a proxy that answers the first
PUTof each part with503. WithRetryLayer(max_times = 3) outsideTimeoutLayer, a 4-part write withconcurrent = 4failed withUnexpected (persistent) at write ... service_operation: UploadPart. - A possible fix: reset the retry count of a call each time the call collects a part that succeeded, or give each part task its own backoff.
Reproduction confirmation
- I reproduced this issue against the affected component. For a service-specific report, I used the actual service rather than only a mock, emulator, or source-code analysis.
Are you willing to submit a PR to fix this bug?
- Yes, I would like to submit a PR.
This comment is AI assisted.
- 主要言語
- Rust
- スター
- 5.5k
- フォーク
- 869
- 平均マージ
- 8時間 2分
- マージ済み PR(30日)
- 862
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/opendal のほかの issue
-
bug(services/fs): deleting "/" removes the configured root directory対応中かも @xgbtxy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 81/100
apache/opendal#9635 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
core enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/opendal#9572 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(bindings/nodejs): reject negative and overflowing BigInt values in WriteOptions.chunk and Read/ReaderOptions.gap対応中かも @rohan4naik が今日担当しました。 オープンbindings/nodejs bug
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
apache/opendal#9569 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug(layers/throttle): throttle streaming ReadStream bytes instead of pre-charging ReadOptions::limit upper bounds on open()対応中かも @Xuanwo が今日担当しました。 オープンbug core
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
apache/opendal#9567 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bindings/c bindings/dotnet bindings/go bindings/java bindings/python bindings/ruby core integrations/object_store release release-blocker services/azblob services/azdls services/dropbox services/gcs_grpc services/git services/hf3fs services/redis services/remotestorage services/s3 website
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
apache/opendal#9560 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
メンテナーはふだん 17 日以内に返信
-
bug rust SDK & CLI & REST API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
boxlite-ai/boxlite#3292 ·
メンテナーはふだん 1 日以内に返信
-
Android bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anefzaoui/misterdownloadmanager#2516 ·
メンテナーはふだん 1 日以内に返信
-
editor ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
state:triage tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 89/100
agent8-cash/ethpayserver#731 ·
メンテナーはふだん 1 日以内に返信