Skip to content

s3fs: translation of buffering=-1 to block_size causes read failures #297

Open
@kevinjacobs-delfi

Description

@kevinjacobs-delfi

Versions:

  • fsspec==2024.9.0
  • s3fs==2024.9.0
  • universal_pathlib==0.2.5

This code in core.py is causing problems:

        if "buffering" in fsspec_kwargs:
            fsspec_kwargs.setdefault("block_size", fsspec_kwargs.pop("buffering"))

Translation from buffering -> block_size results in read failures for files opened with buffering=-1 (the default for opening files) when passed to functions like json.load for files on S3.

S3FileSystem.open does not specify what happens if a negative number of passed and I'll file a bug there too.

I don't have a public bucket to post a sample file, but I'll try to find one so that we can reproduce this behavior.

However, the obvious fix is something like this:

        if "buffering" in fsspec_kwargs:
            buffering = fsspec_kwargs.pop("buffering")       
            if buffering > 0:
                fsspec_kwargs.setdefault("block_size", buffering)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions