NotSslRecordException: not an SSL/TLS record

18,576
$ printf '17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100' | xxd -r -p | xxd
00000000: 1700 0000 242d 4552 5220 6d61 7820 6e75  ....$-ERR max nu
00000010: 6d62 6572 206f 6620 636c 6965 6e74 7320  mber of clients 
00000020: 7265 6163 6865 640d 0a15 0000 0002 0100  reached.........
Share:
18,576
Pankaj
Author by

Pankaj

Updated on June 21, 2022

Comments

  • Pankaj
    Pankaj almost 2 years

    I'm using Redis Spring Data (1.8.9.RELEASE) with Lettuce (4.5.0.Final) as underlying Redis driver. It's using netty of version 4.1.29.

    We're using Redis ElastiCache with Encryption-In-Transit and Encryption-At-rest enabled.

    I'm getting below error. I saw a post related to netty's NotSslRecordException in which suggested cause is mismatch of http and https. But we tcp connection with elasticache.

    Caused by: com.lambdaworks.redis.RedisException: com.lambdaworks.redis.RedisConnectionException: Unable to connect to xxx-redis-xxx-0002-002.-redis-xxx.usw2.cache.amazonaws.com:6379
        at com.lambdaworks.redis.LettuceFutures.await(LettuceFutures.java:130)
        at com.lambdaworks.redis.LettuceFutures.awaitOrCancel(LettuceFutures.java:96)
        at com.lambdaworks.redis.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:117)
        at com.lambdaworks.redis.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80)
        at com.sun.proxy.$Proxy344.hgetall(Unknown Source)
        at org.springframework.data.redis.connection.lettuce.LettuceConnection.hGetAll(LettuceConnection.java:2887)
        ... 53 more
    Caused by: com.lambdaworks.redis.RedisConnectionException: Unable to connect to qbo-pprd-redis-rpg-0002-002.qbo-pprd-redis-rpg.jtrqdt.usw2.cache.amazonaws.com:6379
        at com.lambdaworks.redis.RedisConnectionException.create(RedisConnectionException.java:56)
        at com.lambdaworks.redis.cluster.PooledClusterConnectionProvider.lambda$getConnectionAsync$7(PooledClusterConnectionProvider.java:344)
        at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
        at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:797)
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
        at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
        at com.lambdaworks.redis.AbstractRedisClient.lambda$null$0(AbstractRedisClient.java:331)
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
        at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
        at com.lambdaworks.redis.SslConnectionBuilder$SslChannelInitializer$2.userEventTriggered(SslConnectionBuilder.java:212)
        at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329)
        at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315)
        at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307)
        at io.netty.handler.ssl.SslUtils.handleHandshakeFailure(SslUtils.java:319)
        at io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1573)
        at io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1542)
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1183)
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1243)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        ... 1 more
    Caused by: java.util.concurrent.CompletionException: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100
        at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
        at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
        at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:593)
        at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
        ... 38 more
    Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100    
    
  • Pankaj
    Pankaj almost 5 years
    I have set the client to use SSL - lettuceConnectionFactory.setUseSsl(true). This issue is intermittent.