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

Fix unhandled Redis exception in the /api/server/health/ endpoint #7417

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Jan 31, 2024

Motivation and context

CustomCacheBackend does not handle RedisError, so if Redis is not responding, the backend will propagate the exception, and the endpoint will crash with a 500 response code.

This problem has been fixed upstream in django-health-check 3.18, so just update to the latest version and remove our custom cache backend.

The upstream version, unlike ours, doesn't handle sqlite3.DatabaseError, but we're not using SQLite for caching anymore, so I don't think it matters.

How has this been tested?

I checked the endpoint with both working and non-working Redis.

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.

@SpecLad SpecLad marked this pull request as ready for review January 31, 2024 18:28
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Merging #7417 (c576bb4) into develop (3db7be6) will decrease coverage by 0.01%.
Report is 6 commits behind head on develop.
The diff coverage is 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7417      +/-   ##
===========================================
- Coverage    83.46%   83.46%   -0.01%     
===========================================
  Files          373      373              
  Lines        39760    39735      -25     
  Branches      3720     3721       +1     
===========================================
- Hits         33187    33163      -24     
+ Misses        6573     6572       -1     
Components Coverage Δ
cvat-ui 79.31% <ø> (-0.05%) ⬇️
cvat-server 87.27% <100.00%> (+0.03%) ⬆️

`CustomCacheBackend` does not handle `RedisError`, so if Redis is not
responding, the backend will propagate the exception, and the endpoint will
crash with a 500 response code.

This problem has been fixed upstream in django-health-check 3.18, so just
update to the latest version and remove our custom cache backend.

The upstream version, unlike ours, doesn't handle `sqlite3.DatabaseError`,
but we're not using SQLite for caching anymore, so I don't think it matters.
@SpecLad
Copy link
Contributor Author

SpecLad commented Feb 5, 2024

@azhavoro Would you mind reviewing this?

@azhavoro azhavoro merged commit edfafff into cvat-ai:develop Feb 5, 2024
34 checks passed
@cvat-bot cvat-bot bot mentioned this pull request Feb 9, 2024
@SpecLad SpecLad deleted the bump-health-check branch September 30, 2024 10:49
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.

2 participants