-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Added workaround for corrupted zip chunks #7243
Conversation
changelog.d/20231208_152516_andrey_workarround_cache_corrupted_data.md
Outdated
Show resolved
Hide resolved
…_data.md Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru>
…cv/cvat into az/workarround_cache_corrupted_data
cvat/apps/engine/cache.py
Outdated
item = create_item() | ||
else: | ||
# check control sum | ||
if item[2] != zlib.crc32(item[0].getbuffer()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If CVAT is upgraded from a previous release, it could already have entries in the cache, which will not have element #2, in which case an IndexError
will be raised here. You should handle that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed
cvat/apps/engine/cache.py
Outdated
else: | ||
# compare checksum | ||
item_checksum = item[2] if len(item) == 3 else None | ||
if item_checksum != zlib.crc32(item[0].getbuffer()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item[0]
might not be a BytesIO
if it's loaded from a cache created by a previous version.
Co-authored-by: Roman Donchenko <roman@cvat.ai>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #7243 +/- ##
===========================================
- Coverage 81.79% 81.77% -0.02%
===========================================
Files 366 367 +1
Lines 39353 39369 +16
Branches 3642 3644 +2
===========================================
+ Hits 32188 32195 +7
- Misses 7165 7174 +9
|
Motivation and context
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.