Skip to content

RedisLockRegistry using PUB_SUB_LOCK does not work on AWS Elasticache Valkey Serverless #10471

@kistlers

Description

@kistlers

In what version(s) of Spring Integration are you seeing this issue?

6.5.2

Describe the bug

RedisLockRegistry using PUB_SUB_LOCK does not work on AWS Elasticache Valkey Serverless. Internally, Elasticache uses SPUBLISH instead of PUBLISH, as documented on https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/SupportedCommands.html. Check the Note in the "Pub/Sub Commands" section.
PUBLISH is used in this

script. Valkey cluster requires all sharded operations in a Lua script to hash to the same cluster slot cache. In the case of PUBLISH, this does not matter, but it does with SPUBLISH (used in Elasticache Valkey, as described).
In the script, there are three Redis operations:

To Reproduce

  • Create a RedisLockRegistry with a PUB_SUB_LOCK
  • Attach it to an AWS Elasticache Valkey Serverless
    • Alternatively (per my reasoning, that should work) change the PUBLISH to an SPUBLISH in the UNLINK_UNLOCK_SCRIPT and attach it to any valkey/redis.
  • Run a lockRegistry.executeLocked(..) operation
  • Observe the following error: Caused by: io.lettuce.core.RedisCommandExecutionException: ERR Script attempted to access keys that do not hash to the same slot script: b2dedc0ab01c17f9f20e3e6ddb62dcb6afbed0bd, on @user_script:3.

Expected behavior

PubSubLocks should also work on AWS

Sample

I have not yet prepared a sample, as it most likely requires an AWS Elasticache Valkey, which I cannot just provide to you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions