mirromutth/r2dbc-mysql

Connection unexpectedly closed for JDK 1.8.0_292

sshark opened this issue · 3 comments

I got this exception after I upgraded my JDK to 1.8.0_292. It was working fine with JDK 1.8.0_282 or 1.8.0_272. My application setup is Spring Boot 2.3.2.RELEASE with spring-data-r2dbc:1.1.2.RELEASE and r2dbc-mysql 0.8.2.RELEASE. The MySQL server version is 5.7.32. Using JDK 11.0.9 didn't help either. I got the same exception Connection unexpectedly closed after a few tens of calls later. Please advise. Thanks.

2021-05-14 19:31:48,592 [http-nio-9797-exec-1] INFO [o.a.c.c.C.[Tomcat].[localhost].[/api/v1/stats]] DirectJDKLog.java:173 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-14 19:31:48,593 [http-nio-9797-exec-1] INFO [org.springframework.web.servlet.DispatcherServlet] FrameworkServlet.java:525 - Initializing Servlet 'dispatcherServlet'
2021-05-14 19:31:48,604 [http-nio-9797-exec-1] INFO [org.springframework.web.servlet.DispatcherServlet] FrameworkServlet.java:547 - Completed initialization in 11 ms
2021-05-14 19:31:49,225 [reactor-tcp-epoll-1] WARN [dev.miku.r2dbc.mysql.client.ReactorNettyClient] ReactorNettyClient.java:259 - Connection has been closed by peer
2021-05-14 19:31:49,228 [reactor-tcp-epoll-1] ERROR [reactor.core.publisher.Operators] Loggers.java:319 - Operator called default onErrorDropped
dev.miku.r2dbc.mysql.client.MySqlConnectionClosedException: Connection unexpectedly closed
at dev.miku.r2dbc.mysql.client.ClientExceptions.unexpectedClosed(ClientExceptions.java:32)
at dev.miku.r2dbc.mysql.client.ReactorNettyClient.handleClose(ReactorNettyClient.java:260)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:257)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2016)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:359)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onComplete(FluxConcatMap.java:268)
at reactor.core.publisher.EmitterProcessor.checkTerminated(EmitterProcessor.java:489)
at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:350)
at reactor.core.publisher.EmitterProcessor.onComplete(EmitterProcessor.java:293)
at dev.miku.r2dbc.mysql.client.ReactorNettyClient.resumeError(ReactorNettyClient.java:215)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:88)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:214)
at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:442)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:251)
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:366)
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:358)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at dev.miku.r2dbc.mysql.client.MessageDuplexCodec.handleDecoded(MessageDuplexCodec.java:187)
at dev.miku.r2dbc.mysql.client.MessageDuplexCodec.channelRead(MessageDuplexCodec.java:95)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
2021-05-14 19:31:49,240 [reactor-tcp-epoll-1] ERROR [reactor.netty.channel.ChannelOperationsHandler] Loggers.java:319 - [id: 0x3613da96, L:/172.25.63.134:40110 ! R:stats/localhost:3306] Error was received while reading the incoming data. The connection will be closed.
reactor.core.Exceptions$BubblingException: dev.miku.r2dbc.mysql.client.MySqlConnectionClosedException: Connection unexpectedly closed
at reactor.core.Exceptions.bubble(Exceptions.java:173)
at reactor.core.publisher.Operators.onErrorDropped(Operators.java:635)
at reactor.core.publisher.EmitterProcessor.onError(EmitterProcessor.java:275)
at dev.miku.r2dbc.mysql.client.ReactorNettyClient.drainError(ReactorNettyClient.java:254)
at dev.miku.r2dbc.mysql.client.ReactorNettyClient.handleClose(ReactorNettyClient.java:260)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:257)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2016)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:359)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onComplete(FluxConcatMap.java:268)
at reactor.core.publisher.EmitterProcessor.checkTerminated(EmitterProcessor.java:489)
at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:350)
at reactor.core.publisher.EmitterProcessor.onComplete(EmitterProcessor.java:293)
at dev.miku.r2dbc.mysql.client.ReactorNettyClient.resumeError(ReactorNettyClient.java:215)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:88)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:214)
at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:442)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:251)
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:366)
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:358)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96)

Additional info. if my service was connected to the MariaDB 10.3, my service was receiving the results. However, it might cause problems somewhere else and it is not right.

This was because of SSL handshake exception. JDK 1.8.0_291 and onwards have disabled TLS 1.0 and TLS 1.1. Therefore, this is a non-issue

It is a driver issue, and it has been resolved in #208 . See also #182 .