Skip to content

Commit

Permalink
GEODE-8493: Redis idle clients can cause server stuck thread warning (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbey37 authored Sep 17, 2020
1 parent f4498c3 commit b26d04d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package org.apache.geode.redis.internal;

import java.util.concurrent.ExecutorService;

import org.apache.logging.log4j.Logger;

import org.apache.geode.annotations.VisibleForTesting;
Expand All @@ -23,6 +25,7 @@
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.statistics.StatisticsClock;
import org.apache.geode.internal.statistics.StatisticsClockFactory;
import org.apache.geode.logging.internal.executors.LoggingExecutors;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.redis.internal.executor.CommandFunction;
import org.apache.geode.redis.internal.executor.StripedExecutor;
Expand Down Expand Up @@ -63,6 +66,7 @@ public class GeodeRedisServer {
private final RegionProvider regionProvider;
private final PubSub pubSub;
private final RedisStats redisStats;
private final ExecutorService redisCommandExecutor;

private boolean shutdown;

Expand Down Expand Up @@ -91,11 +95,11 @@ public GeodeRedisServer(String bindAddress, int port, InternalCache cache) {
RedisCommandFunction.register();
passiveExpirationManager =
new PassiveExpirationManager(regionProvider.getDataRegion(), redisStats);
redisCommandExecutor = LoggingExecutors.newCachedThreadPool("Redis Command", true);
nettyRedisServer = new NettyRedisServer(() -> cache.getInternalDistributedSystem().getConfig(),
regionProvider, pubSub,
this::allowUnsupportedCommands, this::shutdown, port, bindAddress, redisStats,
cache.getInternalDistributedSystem().getDistributionManager().getExecutors()
.getWaitingThreadPool());
redisCommandExecutor);
}

@VisibleForTesting
Expand Down Expand Up @@ -154,6 +158,7 @@ public synchronized void shutdown() {
logger.info("GeodeRedisServer shutting down");
passiveExpirationManager.stop();
nettyRedisServer.stop();
redisCommandExecutor.shutdown();
redisStats.close();
shutdown = true;
}
Expand Down

0 comments on commit b26d04d

Please sign in to comment.