-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Is this a bug when lock is timeout it throws an excption in spring-integration-redis? #2894
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
Comments
The problem is that if a lock expires while the application has it locked, it means that the data protected by the lock is compromised - some other process could have changed it. The exception is to tell the application that it has happened so that it can take some action to verify the data is ok. If we just exit silently, the application would not know that the data has been compromised. |
We have a ticket to react to the event in case of key expiration: https://jira.spring.io/browse/INT-4286. But that doesn't mean that we are going to change the logic in this We'll think about something internally, but I'm not sure that we can interfere somehow into the locking thread... |
Thank you garyrussell and artembilan! I think that I have undertood the reason.But I am thinking that should you provide method like this?
artembilan, did you mean that RedisLockRegistry provide method overload: In my opinion all the methods above is feasible, and it avoids to use embeded try catch block. |
Everything is just based on the So, no one your suggestion is feasible. Sorry for that... I'm not sure what we are going to do there: need to jump into that and think... May be next week I can switch to that ticket. But for now, I think, this issue is covered with our discussion and looks like there is nothing to do, so let's consider to close it already! Thanks for your time! |
I got it, Thank you very much! |
I use spring-integration-redis for distibution lock and I found that if the lock key is expired, it will throw an exception when I unlock the lock. here is my code:
I read the source code of 'unlock' method in RedisLockRegistry class I found that:
It seems that it is not a bug. I think it mislead the developers likely, at least it mislead me. so, my question is that why not just ignore case that the redis key is expired. Isn't it more friendly to developers. And then I needn't to embeded a try catch block in finally block above.
My English is not good enough probably, Did I describe my question clearly?
Could you please explain that for me? thank you very much!
The text was updated successfully, but these errors were encountered: