ERR EXEC without MULTI - spring redis+jedis

1,025 views
Skip to first unread message

高寒

unread,
Dec 30, 2014, 1:31:37 AM12/30/14
to redi...@googlegroups.com
I meet with exception during a transactional operation with spring-data-redis


I read this post ERR EXEC without MULTI - Jedis which indicates a multi with exec, I also have redisTemplate.setEnableTransactionSupport(true); enabled, the error stood still.

I removed operation logic within the multi-exec block, I found there is no difference whatever is there, the exception happens event with a zero-operation block.

however, the data is actually stored in redis server side, i can get them in log and redis-cli


RedisTemplate<String,Object> cartCache;

public void create(final Cartline cartline) {
  Object txResults = cartCache.execute(new SessionCallback<List>() {
    public List execute(RedisOperations operations) throws DataAccessException {
      String cartId = cartline.getMemberId();
      String cartlineId = cartline.getCartlineId();
      operations.multi();    
      ......           
      return operations.exec();
    }
  });
}

redis.clients.jedis.exceptions.JedisDataException: ERR EXEC without MULTI
    at redis.clients.jedis.Protocol.processError(Protocol.java:115)
    at redis.clients.jedis.Protocol.process(Protocol.java:133)
    at redis.clients.jedis.Protocol.read(Protocol.java:202)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)
    at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:230)
    at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:236)
    at redis.clients.jedis.Transaction.exec(Transaction.java:38)
    at org.springframework.data.redis.connection.jedis.JedisConnection.exec(JedisConnection.java:738)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java:57)
    at com.sun.proxy.$Proxy512.exec(Unknown Source)
    at org.springframework.data.redis.core.RedisTemplate$3.doInRedis(RedisTemplate.java:593)
    at org.springframework.data.redis.core.RedisTemplate$3.doInRedis(RedisTemplate.java:591)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:190)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:140)
    at org.springframework.data.redis.core.RedisTemplate.execRaw(RedisTemplate.java:591)
    at org.springframework.data.redis.core.RedisTemplate.exec(RedisTemplate.java:578)
    at com.znova.stone.cart.repository.impl.CartCacheImpl$1.execute(CartCacheImpl.java:51)
    at com.znova.stone.cart.repository.impl.CartCacheImpl$1.execute(CartCacheImpl.java:1)
    at org.springframework.data.redis.core.RedisTemplate.

Josiah Carlson

unread,
Dec 30, 2014, 2:08:28 PM12/30/14
to redi...@googlegroups.com
Can you show an example of the commands you are using between the operations.multi() and operations.exec() call?

Looking at an example of RedisOperations being used: http://goo.gl/AN1x2U , it looks like you are doing more or less the right stuff... though I can't say for certain (I'm not a Java developer, and I've never used Spring or Jedis).

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

HeartSaVioR

unread,
Dec 31, 2014, 11:16:28 AM12/31/14
to redi...@googlegroups.com
Could you please specify what Redis, Jedis, Spring-Redis version do you use?

Jungtaek Lim (HeartSaVioR)
Reply all
Reply to author
Forward
0 new messages