S3Path.glob(key) randomly fails with IndexError: pop from an empty deque even after confirming that key path is not an empty folder. Testing locally with the same python version on paths with no files returns an empty list (so the error isn't because the path is empty), when testing with non empty paths it works correctly returning a list of S3Path objects.
Error Stacktrace
File "/usr/local/lib/python3.10/site-packages/s3path.py", line 905, in glob
yield from self._glob(pattern)
File "/usr/local/lib/python3.10/site-packages/s3path.py", line 920, in _glob
yield from selector.select()
File "/usr/local/lib/python3.10/site-packages/s3path.py", line 632, in select
for target in self._deep_cached_dir_scan():
File "/usr/local/lib/python3.10/site-packages/s3path.py", line 694, in _deep_cached_dir_scan
cache.add(target_path_parts, target_path)
File "/usr/local/lib/python3.10/site-packages/s3path.py", line 718, in add
self._queue.pop()
IndexError: pop from an empty deque
Source code
the error occurs with two different codes in 2 different places, the first occurrence is inside a config package using S3Path and is random since the package is used in every run but the error doesn't always occur.
Environment
enviroment:
AWS ECS
python version:3.10.9
(python:3.10-buster docker image) package version:0.4.1
Error Details
S3Path.glob(key)
randomly fails withIndexError: pop from an empty deque
even after confirming thatkey
path is not an empty folder. Testing locally with the same python version on paths with no files returns an empty list (so the error isn't because the path is empty), when testing with non empty paths it works correctly returning a list ofS3Path
objects.Error Stacktrace
Source code
the error occurs with two different codes in 2 different places, the first occurrence is inside a config package using
S3Path
and is random since the package is used in every run but the error doesn't always occur.First occurrence
Second occurance
the error is not from
list.pop()
on an empty list because then it will beIndexError: pop from empty list
and not the above error.let me know if you need any other information.