corvus
corvus copied to clipboard
Can I use Lettuce with corvus? Maybe there are some bugs!
client : Lettuce,a aync client base netty nio
corvus version : a Secondary development version base eleme/corvus master(update to date) redis: redis cluster
problem:
when run my code some time, i got some exceptions like this:

tcpdump:
I find some things wrong by tcpdump.
- the corvus response do not follow the RESP. like
*2 $-1should be*2 $-1 $-1 - the response order is incorrect , so cannot be matched (request) one by one
just like this photos:

reproducer code:
public class RedisOptionV2 {
private static RedisAsyncCommands<String, String> ASYNC;
private static boolean flag = false;
private static AtomicLong index = new AtomicLong(0);
static {
RedisURI redisURI = RedisURI.create("corvus ip", 6666);
RedisClient redisClient = RedisClient.create(redisURI);
StatefulRedisConnection<String, String> connection = redisClient.connect();
ASYNC = connection.async();
}
@PostConstruct
void init() {
MyExecutorService.schedule(this::lettuceTestTask, 30, TimeUnit.SECONDS);
}
private void lettuceTestTask() {
for (long i = 0; i < Long.MAX_VALUE; i++) {
try {
MyExecutorService.submit(this::lettuceDemo);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
public void lettuceDemo() {
try {
List<String> keys = new ArrayList<>();
keys.add("debugLettuceKey" + index.getAndIncrement());
if (flag) {
keys.add("debugLettuceKey2");
flag = false;
} else {
flag = true;
}
//core code
RedisFuture<List<KeyValue<String, String>>> future = ASYNC.mget(keys.toArray(new String[0]));
future.whenCompleteAsync((e, t) -> {
if (t == null) {
log.info("{} res: {}", keys, e);
} else {
log.error("调用redis失败, {} res : {}", keys, e, t);
}
}, MyExecutorService.getExecutorService());
} catch (Throwable t) {
log.error("fail to execute task", t);
}
}
}
Looking forward to reply!Thanks
you can try camellia-redis-proxy