question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intermittent / transient fiona.open errors using AWS S3 + lambda

See original GitHub issue

Expected behavior and actual behavior.

I’m using fiona==1.8.6 on AWS lambda to open shapefiles on S3. I’m seeing occasional clusters of fiona.open errors and was wondering (1) whether anyone else has seen similar behavior, and (2) whether there is anything I can do to reduce the frequency of these errors.

The stack traces look like this:

my_shapefile = fiona.open(shapefile_uri)
File "/var/task/fiona/__init__.py", line 249, in open
enabled_drivers=enabled_drivers, **kwargs)
File "/var/task/fiona/collection.py", line 160, in __init__
self.session.start(self, **kwargs)
File "fiona/ogrext.pyx", line 468, in fiona.ogrext.Session.start
File "fiona/_shim.pyx", line 73, in fiona._shim.gdal_open_vector
fiona.errors.DriverError: '/vsis3/my_aws_bucket/my_reference_data/index.shp' not recognized as a supported file format.

In case it matters, index.shp in the stack trace above is a US national index shapefile pointing to state-specific child shapefiles.

The stack traces can also look like this:

my_shapefile = fiona.open(shapefile_uri)
File "/var/task/fiona/env.py", line 406, in wrapper
return f(*args, **kwargs)
File "/var/task/fiona/__init__.py", line 253, in open
layer=layer, enabled_drivers=enabled_drivers, **kwargs)
File "/var/task/fiona/collection.py", line 159, in __init__
self.session.start(self, **kwargs)
File "fiona/ogrext.pyx", line 484, in fiona.ogrext.Session.start
File "fiona/_shim.pyx", line 80, in fiona._shim.gdal_open_vector
fiona.errors.DriverError: Failed to read all values for 33144 records in .shx file: No such file or directory.

These errors occur infrequently but are clustered in time – see below.

Steps to reproduce the problem.

I’m not able to reproduce the problem consistently. My AWS lambda code opens the same S3 shapefile every time the lambda is invoked. The fiona.open call succeeds most of the time (say, >95%), but I occasionally get the errors described above (and these errors tend to be clustered in time).

Operating system

AWS lambda with runtime = "python3.6" (see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).

Fiona and GDAL version and provenance

I’ve gotten this error with both fiona==1.8.6 and fiona==1.8a2.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sgilliescommented, Aug 15, 2019

@atorch I have a correction to what I wrote above. Fiona has never enabled dataset handle sharing and so shared handles aren’t implicated.

1reaction
sgilliescommented, Jun 15, 2019

@atorch this sounds similar to the problem reported in https://rasterio.groups.io/g/main/message/225. I think it’s likely to involve GDAL and curl and that more clues will be found by running this program with CPL_CURL_VERBOSE=YES https://trac.osgeo.org/gdal/wiki/ConfigOptions#CPL_CURL_VERBOSE. This setting dumps will dump out all the HTTP request headers and status codes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Lambda invoke errors for Amazon S3 event ...
If your Amazon S3 bucket doesn't have the permissions required to invoke your Lambda function, then Lambda returns the following error:.
Read more >
making grids work: Topics by Science.gov
The Unstructured Grid Adaptation Working Group is an open gathering of researchers working on adapting simplicial meshes to conform to a metric field....
Read more >
the 2 of 3 and 4 0 5 to 6 a 7 in 8 1 9 for 10 image 11 2 12 is 13
... 20 data 21 this 22 are 23 be 24 as 25 with 26 6 27 7 28 from 29 use 30 -2002...
Read more >
Elsevier BV | Scholars@Duke
2021; 6.14 Randomized, Placebo-Controlled Trial With Open-Label Extension of ... 12:S2-S3. ... IN PATIENTS WITH INTERMITTENT CLAUDICATION: A META–ANALYSIS.
Read more >
Untitled
How to list items on amazon mobile? Igg 2000 df candida, Tuition reimbursement for teachers, Noticiero televisa chapo, Paramyxovirus classification, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found