-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
type: bugA general bugA general bug
Milestone
Description
When using the reactiveRedisTemplate, if the request is canceled while obtaining a connection, it will result in the connection not being released
My monitor code ,activeIdle has been rising slowly without being released
LettuceConnectionFactory factory = (LettuceConnectionFactory) redisConnectionFactory;
Object currentProvider = getField(factory, "reactiveConnectionProvider");
if (currentProvider == null) {
return;
}
Object delegate = getField(currentProvider, "delegate");
if (delegate == null) {
return;
}
Map<Class<?>, AsyncPool<StatefulConnection<?, ?>>> asyncPools =
(Map<Class<?>, AsyncPool<StatefulConnection<?, ?>>>) getField(delegate, "asyncPools");
if (asyncPools == null) {
return;
}
for (Map.Entry<Class<?>, AsyncPool<StatefulConnection<?, ?>>> entry : asyncPools.entrySet()) {
AsyncPool<StatefulConnection<?, ?>> value = entry.getValue();
BoundedAsyncPool boundedAsyncPool = (BoundedAsyncPool) value;
int idle = boundedAsyncPool.getIdle();
int maxTotal = boundedAsyncPool.getMaxTotal();
int totalIdle = boundedAsyncPool.getObjectCount();
int activeIdle = totalIdle - idle;
int creationInProgress = boundedAsyncPool.getCreationInProgress();
log.info("monitor | activeIdle:{} | idle:{} | creation:{} | totalIdle:{} | max:{}",
activeIdle,
idle,
creationInProgress,
totalIdle,
maxTotal);
return;
}When executing res.complete, it may have already been canceled,There is a concurrency issue here (may be)
private void completeAcquire(CompletableFuture<T> res, T o) {
if (res.isCancelled()) {
this.return0(o);
} else {
res.complete(o);
}
}My lettuce version ==> 5.3.7.RELEASE
My spring-boot-starter-data-redis-reactive ==> 2.3.7.RELEASE
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug