redisson: RedisException: ERR Error running script while using RRateLimiter

I currently have an application where I first create a RRateLimiter. I then acquire one permit in a loop and do an operation. This application is intended to run in a distributed fashion. To test the behavior, I set off concurrent invocations of this program. While it works well for the most part, it does throw an error occasionally as described below.

Expected behavior No error. The thread waits to acquire a permit and does so.

Actual behavior Occasionally, the limiter.acquire() in the below code throws the following error - org.redisson.client.RedisException: ERR Error running script (call to f_df5536206d0c440727a5f17ab38851a31af682c7): @user_script:1: user_script:1: bad argument #2 to 'unpack' (string expected, got nil) . channel: [id: 0x21ed2b8c, L:/169.254.76.1:60060 - R:/10.24.141.126:6379] command: (EVAL), params: [local rate = redis.call('hget', KEYS[1], 'rate');local interval = redis.call('hget', KEYS[1], 'inter..., 5, test, {test}:value, {test}:value:a070c033-9d81-4fd9-b2f7-55a15a4cc468, {test}:permits, {test}:permits:a070c033-9d81-4fd9-b2f7-55a15a4cc468, 1, 1597793996430, -2193289253268890349]

Steps to reproduce or test case Code snippet in AWS lambda talking to elasticache -

RRateLimiter limiter = redisson.getRateLimiter("test");
limiter.trySetRate(RateType.OVERALL, 1, 2, RateIntervalUnit.SECONDS);
while (true) {
                try {
                    limiter.acquire();
                    context.getLogger().log("get semaphore");
                    sqs.sendMessage(new SendMessageRequest()
                            .withQueueUrl("https://sqs_url")
                            .withMessageBody(new Date().toString()));
                    context.getLogger().log("sent to sqs");
                }
                catch (Exception ex) {
                    context.getLogger().log("Error in loop:" + ex);
                }
            }

Redis version Elasticache, 5.0.6

Redisson version 3.13.3

Redisson configuration Elasticache cluster config

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (13 by maintainers)

Commits related to this issue

Most upvoted comments