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
FeatureStoreRedis is not thread-safe #129
Comments
This is because a single redisConnection is used to do everything, which is obviously not safe, when used from multiple threads. |
|
Same true for the PropertyStore and probably any other Redis based store there is |
I understand what you did. Thank you for that. Still you introduced SpringData where there is no real added value. I also have to allow connections through RedisSentinel. As a consequence I will probable create some interface JedisConnection provider |
I was not proposing to integrate SpringData in any way. |
It's just that we're using Spring already in our app. Therefore it was much easier to use JedisConnectionFactory directly |
Done, the JedisPool is now always enable to be thread safe. The Sentinel can also be enable ready to realease |
When a method annotated with .@Flip is called concurrently from multiple threads, this very easily results in error getting the feature from the store.
E.g.
java.lang.ClassCastException: java.lang.Long cannot be cast to [B
at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:216)
at redis.clients.jedis.Connection.getBulkReply(Connection.java:205)
at redis.clients.jedis.Jedis.get(Jedis.java:105)
at org.ff4j.store.FeatureStoreRedis.read(FeatureStoreRedis.java:136)
at org.ff4j.FF4j.getFeature(FF4j.java:465)
at org.ff4j.FF4j.check(FF4j.java:165)
at org.ff4j.aop.FeatureAdvisor.shouldFlip(FeatureAdvisor.java:202)
at org.ff4j.aop.FeatureAdvisor.invoke(FeatureAdvisor.java:79)
The text was updated successfully, but these errors were encountered: