-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Null Elements Returned By CrudRepository.findAll() for Expired Keys [DATAREDIS-570] #1145
Comments
arpan2501 commented Team any updates on this, as we are still facing this issue. We are retrieving null values with keys expiry time set to 5 minutes but data retrieved is days old which is null |
kubav182 commented Can you pls fix this bug? |
Enoobong Ibanga commented Hi Christoph Strobl any updates on this please? |
Eugene Zrazhevsky commented Still being critical |
We are also facing that. |
This bug not only affects For example, I was able to implement a workaround to get rid of the garbage. First, use Then do something like this: @Component
@RequiredArgsConstructor
public class RedisCleanupRunner implements ApplicationRunner {
private final RedisTemplate<String, String> template;
@Override
public void run(ApplicationArguments args) throws Exception {
SetOperations<String, String> setOps = template.opsForSet();
HashOperations<String, Object, Object> hashOps = template.opsForHash();
private final String redisKey = "yourKeySpace";
Set<String> ids = setOps.members(redisKey);
for (String id : ids) {
String key = redisKey + ":" + id;
if (!TRUE.equals(template.hasKey(key))) {
hashOps.put(key, "foo", "bar");
template.expire(key, Duration.ofMillis(1));
}
}
}
} The expiration of the newly created entries will trigger the If you have multiple RedisHash classes, run the above code in a loop for each one. |
Hello. Is this fixed? I'm dealing with this problem :( |
I'm joining the 'would be great if this would be fixed' crowd. But so far the workaround of @bergerst is working. |
I tried @bergerst workaround but it is not working for me. The issue is very random. |
Has a solution been found in the new versions? |
omg, so this bug has not been fixed in 7 years |
Please fix this issue. |
Definitely a weird bug but glad to hear i am not alone. I was perplexed when a customer did not receive credits after paying for my service. On checking the logs, i found that |
+1 Please do something , or suggest a proper workaround, Thanks |
Is there any news about this ? The workaround provided by @bergerst might be working, it should not be required to have such code in production for every project using Spring Data Redis... |
Brian Marcey opened DATAREDIS-570 and commented
The Redis documentation states that "if a key expires while the application is down the expiry event will not be processed which may lead to secondary indexes containing still references to the expired object."
I would expect this behavior and have indeed seen it while testing my code.
However, I have also noticed that if I restart my application after the above scenario occurs,
CrudRepostitory.findAll() will return a null value for each of the orphaned Ids. I didn't expect that and I can work around it, but it would be nice if SDR could detect this condition and not even include them in the returned Iterable. Note that CrudRepository.count() also returns an incorrect value under this scenario.
I can include more information if the above is not clear. Thank you!
Affects: 1.7.4 (Hopper SR4)
6 votes, 8 watchers
The text was updated successfully, but these errors were encountered: