Skip to content

Commit d0113fc

Browse files
author
Donal Evans
authored
GEODE-9552: Change how Radish server shutdown/disconnect is handled (#6871)
- Close client connection on CancelException - Fix handling of RedisCommandParserException - Remove unused constants Authored-by: Donal Evans <doevans@vmware.com>
1 parent d58df40 commit d0113fc

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/RedisConstants.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ public class RedisConstants {
2424
"The command received by GeodeRedisServer was improperly formatted";
2525
public static final String SERVER_ERROR_MESSAGE =
2626
"The server had an internal error please try again";
27-
public static final String SERVER_ERROR_SHUTDOWN = "The server is shutting down";
2827
public static final String ERROR_SELECT = "Only DB 0 supported";
2928
public static final String ERROR_CURSOR = "invalid cursor";
3029
public static final String ERROR_UNKNOWN_COMMAND =
3130
"unknown command `%s`, with args beginning with: %s";
3231
public static final String ERROR_OUT_OF_RANGE = "The number provided is out of range";
33-
public static final String ERROR_NO_PASS = "Client sent AUTH, but no password is set";
34-
public static final String ERROR_INVALID_PWD = "invalid password";
3532
public static final String ERROR_NOT_AUTH = "NOAUTH Authentication required.";
3633
public static final String ERROR_WRONG_TYPE =
3734
"Operation against a key holding the wrong kind of value";

geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/netty/ExecutionHandlerContext.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
import io.netty.channel.ChannelFuture;
2525
import io.netty.channel.ChannelHandlerContext;
2626
import io.netty.channel.ChannelInboundHandlerAdapter;
27-
import io.netty.handler.codec.DecoderException;
2827
import org.apache.logging.log4j.Logger;
2928
import org.apache.shiro.subject.Subject;
3029

31-
import org.apache.geode.cache.CacheClosedException;
30+
import org.apache.geode.CancelException;
3231
import org.apache.geode.cache.LowMemoryException;
3332
import org.apache.geode.distributed.DistributedMember;
3433
import org.apache.geode.internal.security.SecurityService;
@@ -163,13 +162,15 @@ private RedisResponse getExceptionResponse(ChannelHandlerContext ctx, Throwable
163162
return RedisResponse.error(rootCause.getMessage());
164163
} else if (rootCause instanceof LowMemoryException) {
165164
return RedisResponse.oom(RedisConstants.ERROR_OOM_COMMAND_NOT_ALLOWED);
166-
} else if (rootCause instanceof DecoderException
167-
&& rootCause.getCause() instanceof RedisCommandParserException) {
165+
} else if (rootCause instanceof RedisCommandParserException) {
168166
return RedisResponse
169167
.error(RedisConstants.PARSING_EXCEPTION_MESSAGE + ": " + rootCause.getMessage());
170-
} else if (rootCause instanceof InterruptedException
171-
|| rootCause instanceof CacheClosedException) {
172-
return RedisResponse.error(RedisConstants.SERVER_ERROR_SHUTDOWN);
168+
} else if (rootCause instanceof InterruptedException || rootCause instanceof CancelException) {
169+
logger
170+
.warn("Closing Redis client connection because the server doing this operation departed: "
171+
+ rootCause.getMessage());
172+
channelInactive(ctx);
173+
return null;
173174
} else {
174175
if (logger.isErrorEnabled()) {
175176
logger.error("GeodeRedisServer-Unexpected error handler for {}", ctx.channel(), rootCause);

0 commit comments

Comments
 (0)