scala-redis-nb
scala-redis-nb copied to clipboard
RedisClient Factory Method Not Thread-Safe
The apply
method within the RedisClient object is not thread-safe. It uses the thread-unsafe Iterator.next
method to create a default name. This results in name collisions in Akka.
An example of the Iterator.next method not being thread-safe:
val i = Iterator from 0
val fs = Seq.fill(10000)(Future(i.next))
// This should print 10000 but will likely print something else (the last time I tried it was 9964)
Future.sequence(fs).foreach(values => println(values.toSet.size))
I've included a stack-trace showing the issue appearing in our production environment.
Thanks for pointing out .. have a look ..