Skip to content

Cancel pending chunks when a parallel download fails - #1100

Open
thompsonsed wants to merge 1 commit into
fsspec:mainfrom
thompsonsed:cancel-pending-download-chunks
Open

thompsonsed wants to merge 1 commit into
fsspec:mainfrom
thompsonsed:cancel-pending-download-chunks

Conversation

@thompsonsed

@thompsonsed thompsonsed commented Nov 30, 2026 •

Copy link
Copy Markdown

Problem

asyncio.gather re-raises the first failure but leaves sibling chunk tasks running, so their response bodies stay open.

Fix

Add _gather_or_cancel in s3fs/core.py to cancel and await the remaining chunk tasks on any failure. Use it in _cat_file and _get_file.

Tests

Add parametrised test_parallel_download_cancels_pending_chunks coverage for get_file and cat_file.

@thompsonsed
thompsonsed marked this pull request as ready for review November 30, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant