Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError when DirCache is disabled #153

Open
sutao opened this issue Mar 8, 2024 · 0 comments
Open

KeyError when DirCache is disabled #153

sutao opened this issue Mar 8, 2024 · 0 comments

Comments

@sutao
Copy link

sutao commented Mar 8, 2024

When I tried to disable DirCache by passing use_listings_cache=False or listings_expiry_time=0, any listing operation would raise a KeyError, this is due to fsspec's DirCache raising KeyError if no cached item is found.

The cause of the error is from ossfs/core.py line 183.

        try:
            self.dircache[norm_path] = self._get_object_info_list(
                bucket_name, prefix, delimiter, connect_timeout
            )
            return self.dircache[norm_path]  # <-- Raises KeyError if DirCache is disabled
        except oss2.exceptions.AccessDenied:
            return []

It should be changed to:

        try:
            obj_info_list = self._get_object_info_list(
                bucket_name, prefix, delimiter, connect_timeout
            )
            self.dircache[norm_path] = obj_info_list
            return obj_info_list
        except oss2.exceptions.AccessDenied:
            return []

There might be other places in the SDK that need fixing.

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

No branches or pull requests

1 participant