-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
/vsis3/ Using cached response when creds changed #2294
Comments
/vsis3/: invalidate cached non-existing file is AWS_ config options are changed in the meantime (fixes #2294)
Thanks for the fix @rouault ! I've tried it with the example I've included in the first comment of this issue, and your fix has solved one of the examples I've given, but not both.
Case number 2 is a bit far-fetched though, so maybe you had good reasons not to address it? |
I didn't have it in mind. The fix I did relies on not relying on cached data that indicates a failed open, when AWS_ settings have changed. "Fixing" 2 would require different logic, and I don't see 2) has a practical concern |
Expected behavior and actual behavior.
This issue was first reported at rasterio/rasterio#1877, but after closer investigation the problem comes from GDAL and not
rasterio
.When trying to access a file via
/vsis3/
, if a firstopen
gives an error, due to incorrect credentials for example, all subsequentopen
on the same file will give keep giving errors, even if the credentials are changed.The problem disappears if
CPL_VSIL_CURL_NON_CACHED=/vsis3/
is set.This leads me to think that this is due to GDAL's VSI caching, which serves a cached response even though the headers of the request have changed. If possible, the cache should be invalidated for that file whenever it is detected that the headers (AWS credentials or AWS region name for example) have changed.
Steps to reproduce the problem.
Write the following python snippet to a directory as snippet.py:
On a machine with the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables set, run from the directory containingsnippet.py
:As you can see, depending on the order in which you set the credentials, you either fail to open the file, or succeed to open the file both times.
Operating system
osgeo/gdal:latest
docker imageGDAL version and provenance
osgeo/gdal:latest
docker imageThe text was updated successfully, but these errors were encountered: