Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting to mysql inside the docker #255

Open
Maxim1-1 opened this issue Mar 1, 2024 · 4 comments · May be fixed by #258
Open

Error connecting to mysql inside the docker #255

Maxim1-1 opened this issue Mar 1, 2024 · 4 comments · May be fixed by #258
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Maxim1-1
Copy link

Maxim1-1 commented Mar 1, 2024

Good afternoon, I'm getting an error connecting to the database inside docker. I have an application that interacts with the database and it works locally. But inside docker I get a connection error. Initially, I tried to run with mysql version 8.3 but later tried to downgrade to 8.0.36 (my local version). Please help me. Flyway migrations to the same database using jdbc work.
my docker-compose services: file-storage: image: file_storage ports: - "8080:8080" build: context: . dockerfile: Dockerfile environment: - R2DBC_URL=r2dbc:mysql://mysql_db:3306/rest - R2DBC_USER=root - R2DBC_PASSWORD=root - DB_URL=jdbc:mysql://mysql_db:3306/rest - DB_USER=root - DB_PASSWORD=root depends_on: - mysql_db mysql_db: image: mysql:8.1 ports: - 3306 restart: always environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: rest MYSQL_USER: test MYSQL_PASSWORD: test

org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection
2024-03-01T21:43:11.124144463Z at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:100) ~[spring-r2dbc-6.1.3.jar!/:6.1.3]
2024-03-01T21:43:11.124146370Z Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
2024-03-01T21:43:11.124148349Z Error has been observed at the following site(s):
2024-03-01T21:43:11.124150258Z *__checkpoint ⇢ Handler com.Maxim.File_storage_API.controllers.AuthRestControllerV1#register(UserDTO) [DispatcherHandler]
2024-03-01T21:43:11.124152441Z *__checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124154194Z *__checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124155970Z *__checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124157852Z *__checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124159660Z *__checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124161524Z *__checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124169316Z *__checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124171285Z *__checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124173073Z *__checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
2024-03-01T21:43:11.124174865Z *__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
2024-03-01T21:43:11.124176594Z *__checkpoint ⇢ HTTP POST "/api/v1/auth/register" [ExceptionHandlingWebHandler]
2024-03-01T21:43:11.124178490Z Original Stack Trace:
2024-03-01T21:43:11.124181117Z at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:100) ~[spring-r2dbc-6.1.3.jar!/:6.1.3]
2024-03-01T21:43:11.124183145Z at reactor.core.publisher.Mono.lambda$onErrorMap$28(Mono.java:3799) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124184961Z at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124186769Z at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124188530Z at reactor.core.publisher.FluxRetry$RetrySubscriber.onError(FluxRetry.java:96) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124190262Z at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124192017Z at reactor.pool.AbstractPool$Borrower.fail(AbstractPool.java:488) ~[reactor-pool-1.0.5.jar!/:1.0.5]
2024-03-01T21:43:11.124193814Z at reactor.pool.SimpleDequePool.lambda$drainLoop$9(SimpleDequePool.java:436) ~[reactor-pool-1.0.5.jar!/:1.0.5]
2024-03-01T21:43:11.124195588Z at reactor.core.publisher.FluxDoOnEach$DoOnEachSubscriber.onError(FluxDoOnEach.java:186) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124197389Z at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.onError(MonoSubscribeOn.java:152) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124200529Z at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124202402Z at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124204152Z at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124205889Z at reactor.core.publisher.MonoCreate$DefaultMonoSink.error(MonoCreate.java:205) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124207637Z at reactor.netty.resources.NewConnectionProvider$DisposableConnect.onError(NewConnectionProvider.java:156) ~[reactor-netty-core-1.1.15.jar!/:1.1.15]
2024-03-01T21:43:11.124211693Z at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:241) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124213590Z at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:315) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124215805Z at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124218583Z at reactor.core.publisher.Operators.error(Operators.java:198) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124220422Z at reactor.core.publisher.MonoError.subscribe(MonoError.java:53) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124222146Z at reactor.core.publisher.Mono.subscribe(Mono.java:4512) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124223895Z at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103) ~[reactor-core-3.6.2.jar!/:3.6.2]
2024-03-01T21:43:11.124225686Z at reactor.netty.transport.TransportConnector$MonoChannelPromise.tryFailure(TransportConnector.java:576) ~[reactor-netty-core-1.1.15.jar!/:1.1.15]
2024-03-01T21:43:11.124227607Z at reactor.netty.transport.TransportConnector.lambda$doResolveAndConnect$11(TransportConnector.java:375) ~[reactor-netty-core-1.1.15.jar!/:1.1.15]
2024-03-01T21:43:11.124229449Z at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124231255Z at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124233073Z at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124234866Z at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124236659Z at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124238418Z at io.netty.util.concurrent.DefaultPromise.setFailure(DefaultPromise.java:110) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124240227Z at io.netty.resolver.InetSocketAddressResolver$2.operationComplete(InetSocketAddressResolver.java:86) ~[netty-resolver-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124242138Z at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124244238Z at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124246280Z at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124248178Z at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124251851Z at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124253717Z at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124255496Z at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124257295Z at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:1128) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124259160Z at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:1067) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124261035Z at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:440) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124262841Z at io.netty.resolver.dns.DnsResolveContext.onResponse(DnsResolveContext.java:646) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124264604Z at io.netty.resolver.dns.DnsResolveContext.access$500(DnsResolveContext.java:68) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124266401Z at io.netty.resolver.dns.DnsResolveContext$2.operationComplete(DnsResolveContext.java:497) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124268210Z at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124269982Z at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124271811Z at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124273891Z at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124275779Z at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124277593Z at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124279395Z at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124281197Z at io.netty.resolver.dns.DnsQueryContext.trySuccess(DnsQueryContext.java:338) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124282958Z at io.netty.resolver.dns.DnsQueryContext.finishSuccess(DnsQueryContext.java:329) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124284706Z at io.netty.resolver.dns.DnsNameResolver$DnsResponseHandler.channelRead(DnsNameResolver.java:1387) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124291831Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124293853Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124295737Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124297578Z at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124299417Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124301271Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124303113Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124305092Z at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124306923Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124308818Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124310704Z at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124312648Z at io.netty.channel.epoll.EpollDatagramChannel.processPacket(EpollDatagramChannel.java:662) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124314552Z at io.netty.channel.epoll.EpollDatagramChannel.recvmsg(EpollDatagramChannel.java:697) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124316364Z at io.netty.channel.epoll.EpollDatagramChannel.access$300(EpollDatagramChannel.java:56) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124318152Z at io.netty.channel.epoll.EpollDatagramChannel$EpollDatagramChannelUnsafe.epollInReady(EpollDatagramChannel.java:536) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124320051Z at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124321841Z at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124325565Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124327506Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124329329Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124331121Z at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
2024-03-01T21:43:11.124333042Z Caused by: java.net.UnknownHostException: Failed to resolve 'mysql_db:3306' [A(1)]
2024-03-01T21:43:11.124334833Z at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:1120) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124336641Z at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:1067) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124338409Z at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:440) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124340245Z at io.netty.resolver.dns.DnsResolveContext.onResponse(DnsResolveContext.java:646) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124342035Z at io.netty.resolver.dns.DnsResolveContext.access$500(DnsResolveContext.java:68) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124343831Z at io.netty.resolver.dns.DnsResolveContext$2.operationComplete(DnsResolveContext.java:497) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124345727Z at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124347516Z at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124349272Z at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124351017Z at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124352938Z at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124354863Z at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124356668Z at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124358463Z at io.netty.resolver.dns.DnsQueryContext.trySuccess(DnsQueryContext.java:338) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124360642Z at io.netty.resolver.dns.DnsQueryContext.finishSuccess(DnsQueryContext.java:329) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124364780Z at io.netty.resolver.dns.DnsNameResolver$DnsResponseHandler.channelRead(DnsNameResolver.java:1387) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124366866Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124369498Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124372488Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124374986Z at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124377435Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124379827Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124382250Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124384624Z at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124386936Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124389845Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124392670Z at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124395818Z at io.netty.channel.epoll.EpollDatagramChannel.processPacket(EpollDatagramChannel.java:662) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124398311Z at io.netty.channel.epoll.EpollDatagramChannel.recvmsg(EpollDatagramChannel.java:697) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124400737Z at io.netty.channel.epoll.EpollDatagramChannel.access$300(EpollDatagramChannel.java:56) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124403644Z at io.netty.channel.epoll.EpollDatagramChannel$EpollDatagramChannelUnsafe.epollInReady(EpollDatagramChannel.java:536) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124405974Z at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124411443Z at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) ~[netty-transport-classes-epoll-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124414066Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124416680Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124419286Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.105.Final.jar!/:4.1.105.Final]
2024-03-01T21:43:11.124421898Z at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
2024-03-01T21:43:11.124424219Z Caused by: io.netty.resolver.dns.DnsErrorCauseException: Query failed with SERVFAIL
2024-03-01T21:43:11.124426670Z at io.netty.resolver.dns.DnsResolveContext.onResponse(..)(Unknown Source) ~[netty-resolver-dns-4.1.105.Final.jar!/:4.1.105.Final]

@mirromutth mirromutth self-assigned this Mar 2, 2024
@mirromutth mirromutth added the bug Something isn't working label Mar 2, 2024
@mirromutth mirromutth added this to the 1.1.3 milestone Mar 2, 2024
@mirromutth
Copy link
Contributor

mirromutth commented Mar 2, 2024

Seems to be caused by reactor-netty:1.1.9 on reactor-bom:2022.0.9. I had the same error and then when I tried upgrading it to reactor-bom:2022.0.16 this error gone. But I haven't seen any reports of this in reactor-netty or netty, more investigation is needed.

In addition, we should use reactor-netty-core instead of reactor-netty to slim dependencies. reactor-netty contains reactor-netty-http and reactor-netty-incubator-quic, which are not what we need.

It has been reproduced on Windows 11 and docker with eclipse-temurin:17-jdk-alpine image


2024-03-05: It cannot be reproduced on macOS 14.2.1 and docker 25.0.3 with eclipse-temurin:17-jdk image.

@mirromutth
Copy link
Contributor

mirromutth commented Mar 5, 2024

Would you mind letting me know what operating system, docker version, java image version in Dockerfile, and spring-data-r2dbc version you are using?


2024-03-06: Now it can be reproduced, a very inconspicuous configuration

@mirromutth mirromutth added the need-more-info requested for more information label Mar 5, 2024
@mirromutth mirromutth removed this from the 1.1.3 milestone Mar 5, 2024
@mirromutth mirromutth removed the need-more-info requested for more information label Mar 6, 2024
@mirromutth
Copy link
Contributor

mirromutth commented Mar 6, 2024

Sorry, I overlooked an important factor.

The hostname in the docker-compose.yaml file contains underscores, and r2dbc-spi cannot parse it correctly because java.net.URI cannot process it correctly. See also https://stackoverflow.com/questions/28568188 .

This causes DNS to resolve host "mysql_db:3306" instead of "mysql_db", so the resolution always fails.

Except for the first time, all my attempts were to write the docker-compose.yaml files myself, thus using hostnames without underscores, causing all my previous replies to be incorrect.

Strictly speaking, hostnames cannot contain underscores, so it's hard to tell whether this is intentional or not.

See:

K8s service names also do not allow underscores: https://stackoverflow.com/questions/77514907

See also r2dbc/r2dbc-spi#280 , ConnectionUrlParser

Parsing Code
import io.r2dbc.spi.ConnectionFactoryOptions;

public class ParsingMain {

    public static void main(String[] args) {
        ConnectionFactoryOptions o1 = ConnectionFactoryOptions.parse("r2dbc:mysql://underscore_db:3306");

        System.out.println(o1.getRequiredValue(ConnectionFactoryOptions.HOST));
        System.out.println(o1.getValue(ConnectionFactoryOptions.PORT));

        ConnectionFactoryOptions o2 = ConnectionFactoryOptions.parse("r2dbc:mysql://std-db:3306");

        System.out.println(o2.getRequiredValue(ConnectionFactoryOptions.HOST));
        System.out.println(o2.getValue(ConnectionFactoryOptions.PORT));

        URI u1 = URI.create("r2dbc://underscore_db:3306"); // ConnectionFactoryOptions.parse rewrites the URI

        System.out.println(u1.getHost()); // null
        System.out.println(u1.getPort()); // -1

        URI u2 = URI.create("r2dbc://std-db:3306");

        System.out.println(u2.getHost()); // std-db
        System.out.println(u2.getPort()); // 3306
    }
}

@Maxim1-1
Copy link
Author

Maxim1-1 commented Mar 6, 2024

Thank you so much for such a detailed answer, it helped me. I wish you success!!!

@mirromutth mirromutth linked a pull request Mar 12, 2024 that will close this issue
9 tasks
@mirromutth mirromutth added this to the 1.2.0 milestone Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants