Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/io/lettuce/core/RedisPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* are emitted as they are decoded. Otherwise, results are processed at command completion.
*
* @author Mark Paluch
* @author Tihomir Mateev
* @since 5.0
*/
class RedisPublisher<K, V, T> implements Publisher<T> {
Expand Down Expand Up @@ -293,7 +294,7 @@ public void onNext(T t) {
try {
DEMAND.decrementAndGet(this);
this.subscriber.onNext(t);
} catch (Exception e) {
} catch (Throwable e) {
onError(e);
}
return;
Expand Down Expand Up @@ -544,7 +545,7 @@ void request(RedisSubscription<?> subscription, long n) {

try {
subscription.checkCommandDispatch();
} catch (Exception ex) {
} catch (Throwable ex) {
subscription.onError(ex);
}
subscription.checkOnDataAvailable();
Expand Down Expand Up @@ -575,7 +576,7 @@ void onDataAvailable(RedisSubscription<?> subscription) {
return;
}
} while (subscription.hasDemand());
} catch (Exception e) {
} catch (Throwable e) {
subscription.onError(e);
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/io/lettuce/core/protocol/CommandEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ private void encode(ChannelHandlerContext ctx, ByteBuf out, RedisCommand<?, ?, ?
try {
out.markWriterIndex();
command.encode(out);
} catch (RuntimeException e) {
out.resetWriterIndex();
command.completeExceptionally(new EncoderException(
"Cannot encode command. Please close the connection as the connection state may be out of sync.", e));
} catch (Throwable e) {
ctx.close();
logger.error("{} Cannot encode command. Closing the connection as the connection state may be out of sync.",
logPrefix(ctx.channel()), e);
throw new EncoderException(
"Cannot encode command. Closing the connection as the connection state may be out of sync.", e);
}

if (debugEnabled) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/lettuce/core/protocol/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* @author Daniel Albuquerque
* @author Gavin Cook
* @author Anuraag Agrawal
* @author Tihomir Mateev
*/
public class CommandHandler extends ChannelDuplexHandler implements HasQueuedCommands {

Expand Down Expand Up @@ -646,8 +647,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Interrup
return;
}

} catch (Exception e) {

} catch (Throwable e) {
ctx.close();
throw e;
}
Expand All @@ -672,8 +672,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Interrup
decodeBufferPolicy.afterPartialDecode(buffer);
return;
}
} catch (Exception e) {

} catch (Throwable e) {
ctx.close();
throw e;
}
Expand All @@ -691,8 +690,9 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Interrup
logger.debug("{} Completing command {}", logPrefix(), command);
}
complete(command);
} catch (Exception e) {
} catch (Throwable e) {
logger.warn("{} Unexpected exception during request: {}", logPrefix, e.toString(), e);
command.completeExceptionally(e);
}
}
}
Expand Down
Loading
Loading