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

MemcachedCache#get doesn't ensure it returns the results for the key its asked #16568

Open
kgyrtkirk opened this issue Jun 6, 2024 · 0 comments

Comments

@kgyrtkirk
Copy link
Member

this might be a theoretical level issue; but:

  • the get method maps the key to a hash and looks that up
  • the hash uses sha1 (which should provide enough spread)

however it can't be ruled out to have 2 key mapping to the same hash value.

the current implementation doesn't validate that it got the cached value for that key or some other.

future = clientHolder.get().asyncGet(computeKeyHash(memcachedPrefix, key));
}
catch (IllegalStateException e) {
// operation did not get queued in time (queue is full)
errorCount.incrementAndGet();
log.warn(e, "Unable to queue cache operation");
return null;
}
try {
byte[] bytes = (byte[]) future.get(timeout, TimeUnit.MILLISECONDS);
if (bytes != null) {
hitCount.incrementAndGet();
} else {
missCount.incrementAndGet();
}
return bytes == null ? null : deserializeValue(key, bytes);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant