Skip to content

Reject position-changing seeks on async HTTP streams - #2214

Merged
martindurant merged 2 commits into
fsspec:masterfrom
charan-rathore:fix-async-streamfile-seek
Oct 13, 2026
Merged

martindurant merged 2 commits into
fsspec:masterfrom
charan-rathore:fix-async-streamfile-seek

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

AsyncStreamFile inherits a seek implementation that updates its logical position, but HTTP streaming reads continue from the same response. A seek therefore appears to work while returning bytes from the wrong offset.

Follow the maintainer's direction in #1772: streaming files should not be seekable. Mirror HTTPStreamFile's no-op seek behavior and ValueError for position-changing seeks, and report seekable() as False. Sequential reads and tell remain consistent; this does not add random-access support or alter other async file implementations.

Tests use the repository's local HTTP server. They cover rejected forward, backward, relative and end-based seeks, allowed no-op seeks, unchanged tell after rejection, and subsequent bytes read from the correct position. Add a changelog entry.

Fixes #1772.

@martindurant
martindurant merged commit 8b8bd82 into fsspec:master Oct 13, 2026
11 checks passed
@charan-rathore
charan-rathore deleted the fix-async-streamfile-seek branch October 13, 2026 16:13
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.

Seeking on Async FS is bugged / not-working

2 participants