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

Added workaround for corrupted zip chunks #7243

Merged
merged 13 commits into from
Dec 8, 2023

Conversation

azhavoro
Copy link
Contributor

@azhavoro azhavoro commented Dec 8, 2023

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@azhavoro azhavoro changed the title Added workarround for corrupted zip chunks Added workaround for corrupted zip chunks Dec 8, 2023
…_data.md

Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru>
@bsekachev bsekachev requested review from SpecLad and removed request for nmanovic and Marishka17 December 8, 2023 13:50
cvat/apps/engine/cache.py Outdated Show resolved Hide resolved
item = create_item()
else:
# check control sum
if item[2] != zlib.crc32(item[0].getbuffer()):
Copy link
Contributor

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.

Copy link
Contributor Author

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 Show resolved Hide resolved
cvat/apps/engine/cache.py Outdated Show resolved Hide resolved
else:
# compare checksum
item_checksum = item[2] if len(item) == 3 else None
if item_checksum != zlib.crc32(item[0].getbuffer()):
Copy link
Contributor

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.

cvat/apps/engine/cache.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Merging #7243 (fa830a8) into develop (a4f0cea) will decrease coverage by 0.02%.
Report is 2 commits behind head on develop.
The diff coverage is 75.00%.

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     
Components Coverage Δ
cvat-ui 75.93% <50.00%> (-0.03%) ⬇️
cvat-server 87.09% <88.88%> (-0.01%) ⬇️

@SpecLad SpecLad merged commit 588df39 into develop Dec 8, 2023
34 checks passed
@SpecLad SpecLad deleted the az/workarround_cache_corrupted_data branch December 8, 2023 20:27
@cvat-bot cvat-bot bot mentioned this pull request Dec 11, 2023
amjadsaadeh pushed a commit to amjadsaadeh/cvat that referenced this pull request Dec 14, 2023
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

Successfully merging this pull request may close these issues.

3 participants