KarelCemus / play-redis

Play framework 2 cache plugin as an adapter to redis-server
Mozilla Public License 2.0
166 stars 44 forks source link

Access to Azure Cache for Redis failed #305

Closed raymondsiu99 closed 1 day ago

raymondsiu99 commented 2 weeks ago

Are you filing an issue? Please follow these checklists and provide us all the possible information to speed up the process.

Reporting a bug?

  1. 2.7.0
  2. 2.13.4
  3. ???
  4. Azure AKS
  5. Connection to Azure Cache for Redis
  6. Exception when trying to connection to Azure Cache for Redis
  7. NA

Inject by

@NamedCache("tenants-cache")

configured some thing like

play.cache {
  bindCaches: ["cache1"]
  redis {
    bindCaches: ["cache2"]
    bind-default: false
    instances {
      "cache2": {
        host: "my-redis01.redis.cache.windows.net"
        port: 6380
        password: "<Azure Redis Access Key>"
        ssl: true
        abortConnect: false
        prefix: "tenants"
        timeout: 10000  # 10 seconds timeout
        maxTotal: 20    # Connection pool settings
        maxIdle: 10
        minIdle: 5
      }
    }
  }
}

Got exception like:

[error] p.a.cache.redis - Command GET for key 'cache2:tenant:envs' failed.
redis.actors.InvalidRedisReply$: Could not decode the redis reply (Connection closed)
        at redis.actors.InvalidRedisReply$.<clinit>(RedisReplyDecoder.scala:79)
        at redis.actors.RedisReplyDecoder.$anonfun$postStop$1(RedisReplyDecoder.scala:20)
        at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
        at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
        at redis.actors.RedisReplyDecoder.postStop(RedisReplyDecoder.scala:19)
        at akka.actor.Actor.aroundPostStop(Actor.scala:556)
        at akka.actor.Actor.aroundPostStop$(Actor.scala:556)
        at redis.actors.RedisReplyDecoder.aroundPostStop(RedisReplyDecoder.scala:11)
        at akka.actor.dungeon.FaultHandling.finishTerminate(FaultHandling.scala:240)
[warn] r.a.RedisClientActor - ConnectionClosed ErrorClosed(Connection reset)
[error] p.a.cache.redis - Command GET for key 'cache2:tenant:envs' failed.
redis.actors.InvalidRedisReply$: Could not decode the redis reply (Connection closed)
        at redis.actors.InvalidRedisReply$.<clinit>(RedisReplyDecoder.scala:79)
        at redis.actors.RedisReplyDecoder.$anonfun$postStop$1(RedisReplyDecoder.scala:20)
        at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
        at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
        at redis.actors.RedisReplyDecoder.postStop(RedisReplyDecoder.scala:19)
        at akka.actor.Actor.aroundPostStop(Actor.scala:556)
        at akka.actor.Actor.aroundPostStop$(Actor.scala:556)
        at redis.actors.RedisReplyDecoder.aroundPostStop(RedisReplyDecoder.scala:11)
        at akka.actor.dungeon.FaultHandling.finishTerminate(FaultHandling.scala:240)
[warn] r.a.RedisClientActor - ConnectionClosed ErrorClosed(Connection reset)
[warn] r.a.RedisClientActor - ConnectionClosed ErrorClosed(Connection reset)

Other notes: The Azure Cache for Redis was tested within the container by executing redis-cli

KarelCemus commented 2 weeks ago

Hello, I don't know if I can help you with this report. I cannot reproduce it as you didn't provide any steps to reproduce the issue, and I don't have access to Azure anyway.

It looks like connection misconfiguration but hard to tell without knowing any details.

I believe this is an issue of the configuration but if it is an issue with the underlying connector then you are using an outdated version with rediscala under the hood, which unfortunately has no support from their maintainers, which is why the latest versions of play-redis switched to a different connector.

My recommendation is to properly debug your setup and/or provide minimal steps to reproduce the issue (with docker) and/or updating to the latest versions of play-redis.

raymondsiu99 commented 2 weeks ago

Thanks for your reply; I will recommend my team to update the library; in the meantime I will just deploy redis in AKS for test.