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

⚗️ env-vars to control cachetools #6169

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Aug 12, 2024

What do these changes do?

Occasionally, listing services respond with a 500 error.
image

The logs indicate that this issue is due to a validation error caused by an invalid key in the caching mechanism, which uses the sync library cachetools. The bug appears to stem from concurrent access to a synchronous cache registry. It's important to note that the new design requests each page concurrently, and validation is also performed asynchronously.

The likely solution is to switch to aiocache even for this synchronous case, but that would require some design changes. Before moving forward with that approach, I'd like to introduce these new variables to control the cachetools options and conduct some manual exploratory testing:

  • CACHETOOLS_CACHE_MAXSIZE: Maximum number of items (defaults to 100)
  • CACHETOOLS_CACHE_TTL_SECS: Time-to-live in seconds (defaults to 60 seconds)
  • CACHETOOLS_DISABLE: If set to 1, caching is disabled (defaults to 0)

Related issue/s

How to test

Dev-ops checklist

These variables are only for development pursposes and therefore should not be part of the repo.configs

@pcrespov pcrespov self-assigned this Aug 12, 2024
@pcrespov pcrespov added a:webserver issue related to the webserver service a:catalog catalog service labels Aug 12, 2024
@pcrespov pcrespov added this to the Tom Bombadil milestone Aug 12, 2024
@pcrespov pcrespov enabled auto-merge (squash) August 12, 2024 12:34
@pcrespov pcrespov requested a review from odeimaiz August 12, 2024 12:35
Copy link

Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.8%. Comparing base (cafbf96) to head (5188110).
Report is 421 commits behind head on master.

Files Patch % Lines
...r/src/simcore_service_webserver/catalog/_models.py 85.7% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6169      +/-   ##
=========================================
- Coverage    84.5%   81.8%    -2.8%     
=========================================
  Files          10     577     +567     
  Lines         214   29418   +29204     
  Branches       25     234     +209     
=========================================
+ Hits          181   24064   +23883     
- Misses         23    5294    +5271     
- Partials       10      60      +50     
Flag Coverage Δ
integrationtests 63.7% <85.7%> (?)
unittests 87.4% <85.7%> (+2.9%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...rc/simcore_service_webserver/catalog/_api_units.py 93.0% <ø> (ø)
...r/src/simcore_service_webserver/catalog/_models.py 86.1% <85.7%> (ø)

... and 585 files with indirect coverage changes

@pcrespov pcrespov disabled auto-merge August 12, 2024 13:29
@pcrespov pcrespov merged commit cb41339 into ITISFoundation:master Aug 12, 2024
57 checks passed
@pcrespov pcrespov deleted the is5964/rm-cache-tmp branch August 12, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:catalog catalog service a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants