JedisDataException: ERR WATCH inside MULTI is not allowed

7/7/2019

I use jedis for the use of Redis database. The software is based on AWS services like Redis, SQS, SMS and Kubernetes with PODs etc. Actually everything works fine but once I had the following exception: "JedisDataException: ERR WATCH inside MULTI is not allowed", which happened at the place as is visible in the code. I couldn't make any more requests to Redis (no matter what kind of key I wanted to use). After restarting the POD everything works perfectly. I can't reproduce the error anymore.

Do you have any idea what's the problem? I quess it has something to do with aws-sqs or scaling of PODs and concurrency.

the sequence of events is: event --> aws:sns --> aws:sqs --> k8s:POD (java code) --> add value to aws:redis

Thank you.

public boolean add(key, value) {
   jedis.watch(key);

   Transaction tx = jedis.multi();

   tx.hsetnx(key, value, json);

   if (tx.exec().size() == 0) {

      LOGGER.warn("nothing executed...");
   } else {
      LOGGER.debug("add bike executed...");
   }

   jedis.resetState();
   return true;
}
-- user3930618
amazon-web-services
java
jedis
kubernetes
redis

0 Answers