missing revalidation?

Open
#304 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
go
Domain
backend

Research direction

Start in cache/cache.go at the linked code around line 126 and trace how fetch() releases and reacquires the lock. Check which cache operations can run during the fetch and whether any can make the pending insert invalid. Done means establishing whether revalidation is needed and, if so, defining the behavior before making a change.

Written by the indexing model from the issue text.

Description

Hello, it appears a lock is dropped before a potentially long-running operation, and then reacquired before continuing. This is fine. However, it appears that there is no confirmation that the update is still legal after reacquiring the lock.

Are there any operations that could be performed while fetch() is executing that would invalidate the cache in such a way that the insert should be failed instead of continuing?

https://github.com/juju/utils/blob/bf9cc5bdd62dabc40b7f634b39a5e2dc44d44c45/cache/cache.go#L126

Thanks

Dominant language
Go
Stars
209
Forks
88
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from juju/utils

All issues in juju/utils

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.