Local range download leaves an output file after source-read failure despite delete_on_failure=True
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Đọc hợp đồng tải xuống theo phạm vi trong libcloud/storage/base.py và phần triển khai cục bộ trong libcloud/storage/drivers/local.py. Tái hiện trường hợp nguồn bị thiếu trong issue, sau đó thêm một bài kiểm thử hồi quy bên cạnh các bài kiểm thử hiện có của trình điều khiển cục bộ. Công việc được xem là hoàn tất khi một lần tải xuống theo phạm vi thất bại sẽ xóa đích nếu delete_on_failure=True, còn hành vi khi cờ tắt vẫn như dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On trunk 8a0ef626, the local driver's range-download method creates a destination file but does not clean it up when opening the source fails, even with delete_on_failure=True.
This reproducer is sequential: obtain the object metadata, explicitly remove the stored file, then try to download. It does not depend on winning a filesystem race.
import os
import tempfile
from libcloud.storage.drivers.local import LocalStorageDriver
with tempfile.TemporaryDirectory() as root:
driver = LocalStorageDriver(root)
container = driver.create_container("bucket")
obj = driver.upload_object_via_stream(iter([b"payload"]), container, "object")
os.unlink(driver.get_object_cdn_url(obj))
destination = os.path.join(root, "download")
try:
driver.download_object_range(
obj, destination, start_bytes=0, delete_on_failure=True
)
except FileNotFoundError:
pass
print(os.path.exists(destination), os.path.getsize(destination))
# True 0
The public range-download contract describes delete_on_failure as deleting a partially downloaded file when the download was unsuccessful, with hash mismatch/file size given as examples. I expected the newly created empty output to be removed for a source-read failure as well. Otherwise a failed operation leaves a file that can be mistaken for a valid empty download.
The local implementation accepts the flag but never reads it. It opens the destination before consuming the source iterator and has no failure cleanup around that loop.
Checks with unchanged source, Python 3.12/Linux:
- Range download with
delete_on_failure=True: raisesFileNotFoundError, leaves a zero-byte output. - Range download with
delete_on_failure=False: same result. - Full
download_objectwith the same missing source: returnsFalse, leaves no output. - Successful range
[0, 3)before removing the source: returnsTrue, writesb"pay".
No code change yet. This report is limited to failure cleanup for local range downloads; it does not claim a concurrent-write reproduction or a full test-suite pass.
- Ngôn ngữ chính
- Python
- Star
- 2.1k
- Fork
- 935
- Merge trung bình
- 5 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/libcloud
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
apache/libcloud#2215 · 3 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/libcloud
Issue tương tự
-
Email validation accepts a trailing newlineCó thể đã có người làm @marcello-pichini đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Contributing instructionsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dbt-labs/spark-utils#51 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
vendrabuck/HERD#1419 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày