-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RedisCommandTimeoutException after two subsequent MULTI calls without executing the transaction #673
Comments
main thread: redisClient = RedisClient.create(RedisURI.create("redis://databases.test?timeout=1s"));
pool = ConnectionPoolSupport.createGenericObjectPool(redisClient::connect, new GenericObjectPoolConfig()); service thread(s) try (StatefulRedisConnection<String, String> connection = pool.borrowObject()) {
final RedisCommands<String, String> commands = connection.sync();
commands.multi();
commands.hset(redisConfig.getCollection(), key(key), value);
if (ThreadLocalRandom.current().nextInt(0, 2) == 0) {
throw new RuntimeException();
}
commands.hset(redisConfig.getCollection() + "-fs", key(key), value);
commands.exec();
} catch (Exception ex) {
logger.warn("Redis error", ex);
} after first exception in service thread all commands are failed
|
Lettuce connections require single-threaded/synchronized access when using transactions. If two or more threads call concurrently In your code above, you're leaving the connection in |
But why it cause |
Thanks for pointing this detail out. The second We should be able to fix this so the error gets propagated without causing a timeout. Let me adjust the ticket description. |
It would be great! Thanks! |
That's fixed now. |
Thank you! Also wold be great to add note about |
jar: lettuce:4.4.2.Final
After
ERR MULTI
error all calls to redis are failed withRedisCommandTimeoutException
. Is it known behaviour.ERR MULTI
probably from thread rice condition, but it is strange behaviour when after some error all other calls failed tooThe text was updated successfully, but these errors were encountered: