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

Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443 #1044

Closed
yong3269 opened this issue Nov 14, 2023 · 17 comments
Closed

Comments

@yong3269
Copy link

yong3269 commented Nov 14, 2023

Whenever I try and send a push notification using Pushy 0.15.1 I get the following exception with low probability. Most likely to occur after a longer interval.

2023-11-13 03:23:40.283  WARN 26378 --- [ntLoopGroup-4-1] c.eatthepath.pushy.apns.ApnsChannelPool  : Failed to create channel

io.netty.channel.AbstractChannel$AnnotatedSocketException: Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443
Caused by: java.net.SocketException: Network is unreachable
	at sun.nio.ch.Net.connect0(Native Method) ~[na:1.8.0_322]
	at sun.nio.ch.Net.connect(Net.java:482) ~[na:1.8.0_322]
	at sun.nio.ch.Net.connect(Net.java:474) ~[na:1.8.0_322]
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647) ~[na:1.8.0_322]
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:91) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:88) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_322]
	at io.netty.util.internal.SocketUtils.connect(SocketUtils.java:88) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:315) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:248) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.handler.ssl.SslHandler.connect(SslHandler.java:707) ~[netty-handler-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.handler.codec.http2.Http2ConnectionHandler.connect(Http2ConnectionHandler.java:449) ~[netty-codec-http2-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:517) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:978) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:253) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:250) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497) ~[netty-transport-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.48.Final.jar!/:4.1.48.Final]
	at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_322]

java.util.concurrent.ExecutionException: io.netty.channel.AbstractChannel$AnnotatedSocketException: Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
	...
	at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:750)
Caused by: io.netty.channel.AbstractChannel$AnnotatedSocketException: Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443
Caused by: java.net.SocketException: Network is unreachable
	at sun.nio.ch.Net.connect0(Native Method)
	at sun.nio.ch.Net.connect(Net.java:482)
	at sun.nio.ch.Net.connect(Net.java:474)
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:91)
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:88)
	at java.security.AccessController.doPrivileged(Native Method)
	at io.netty.util.internal.SocketUtils.connect(SocketUtils.java:88)
	at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:315)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:248)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
	at io.netty.handler.ssl.SslHandler.connect(SslHandler.java:707)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.connect(Http2ConnectionHandler.java:449)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:517)
	at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:978)
	at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:253)
	at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:250)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
	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:750)
@ytakamura
Copy link

I've been experiencing the same issue with Pushy 0.13.9 for the past 10 days or so. I think this may be an issue on Apple's side, but I would appreciate any information you can give me.

@jchambers
Copy link
Owner

APNs does not have conventional load balancers (as near as I can tell). Instead, the expectation is that callers will query DNS for a list of active servers, then choose and connect to one of those servers directly. Please see the "best practices" section of "Sending notification requests to APNs" for details. Folks who are familiar with DNS might note that it is generally not considered an immediately-consistent system.

I think what's happening here is that, after some time, Apple retires an APNs server, but its address is still in the DNS record. When Pushy tries to reconnect to that old address, the connection fails. It's possible that there's a bug in Pushy where we're over-caching, but if there is, I haven't found it yet.

In fairness, Apple's best practices suggest:

Make an uncached DNS query to resolve the APNs server name, before each connection.

It may be that in honoring the 30-second TTL on their DNS records, we're violating the "uncached" part of the suggestion. Even so, though, expecting faster-than-30-second propagation of DNS changes seems unreasonable to me, and I'm not sure that would actually be helpful (or really good for the DNS ecosystem as a whole).

For now, I don't think there's anything to be done here; this is just a consequence of some upstream design decisions. At the same time, it sounds like more and more folks have been bumping into this lately. Let's leave this open and see if we can gather more information, I suppose.

@jchambers jchambers changed the title Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443 Network is unreachable: api.push.apple.com/2620:149:208:4308:0:0:0:a:443 Nov 25, 2023
@jchambers
Copy link
Owner

…though, @ytakamura, 0.13.9 is a truly ancient version of Pushy. I'd be curious if you get better results just by updating to a more recent version.

@dpenny-bravas
Copy link

I have been seeing similar issues in the past several weeks as well. It does seem like it has increased significantly in the past three or four weeks. Here is the output from the error I am seeing:

09:03:28.662 [nioEventLoopGroup-2-1] WARN  c.e.pushy.apns.ApnsChannelPool - Failed to create channel
io.netty.channel.AbstractChannel$AnnotatedNoRouteToHostException: No route to host: api.push.apple.com/[2620:149:f9:1021:0:0:0:9]:443
Caused by: java.net.NoRouteToHostException: No route to host
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Net.java:579)
Caused by: java.net.NoRouteToHostException: No route to host

	at java.base/sun.nio.ch.Net.connect(Net.java:586)
	at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:853)
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:91)
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:88)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at io.netty.util.internal.SocketUtils.connect(SocketUtils.java:88)
	at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:322)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:248)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:653)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:632)
	at io.netty.handler.ssl.SslHandler.connect(SslHandler.java:737)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:657)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:632)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.connect(Http2ConnectionHandler.java:464)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:657)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:632)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:616)
	at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:978)
	at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:265)
	at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:264)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:566)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
09:03:28.663 [nioEventLoopGroup-2-1] ERROR i.b.mdm.apple.apns.ApnsConnector - No route to host: api.push.apple.com/[2620:149:f9:1021:0:0:0:9]:443

@jchambers I can't tell from the logs, but will Pushy attempt to send the notification again? If not, it might be helpful to pass the error message up the chain so we can catch it and retry the notification.

@ytakamura
Copy link

I found this thread. https://developer.apple.com/forums/thread/741313
Looks like we have to deal with this change.

@yong3269
Copy link
Author

I added the jvm parameter - Djava.net. preferIPv4Stack=true. domain name is no longer resolved ipv6, there is no problem for the time being. Thanks.

@jchambers
Copy link
Owner

Well, wait—this is still weird. @yong3269 did it ever work for you with IPv6? What happens if you, for example, curl -6 api.push.apple.com?

@jchambers jchambers reopened this Nov 29, 2023
@jchambers
Copy link
Owner

And @dpenny-bravas and @ytakamura, I'd ask the same of you! Does this always fail with IPv6 for you? Is it possible that api.push.apple.com was sometimes resolving to IPv4 and sometimes to IPv6? What happens if you try the curl experiment?

@yong3269
Copy link
Author

yong3269 commented Nov 29, 2023

@jchambers What I see is really probabilistic error. api.push.apple.com resolution to ipv6 will definitely go wrong.

# curl -6 api.push.apple.com
curl: (7) Failed to connect to 2620:149:149:1030::1b: Network is unreachable
# curl -4 api.push.apple.com
curl: (7) Failed connect to api.push.apple.com:80; Connection refused

@jchambers
Copy link
Owner

@yong3269 I think that answers the question, but I should have offered a better set of curl invocations. Specifically:

curl -6 --http2 https://api.push.apple.com
curl -4 --http2 https://api.push.apple.com

@dpenny-bravas
Copy link

@jchambers Since enabling IPv6 on my local network I have not had a single failure.

@jchambers
Copy link
Owner

Okay; it sounds like this was, indeed, a network configuration issue and not something specific to Pushy. Let's consider this resolved for the moment.

@jchambers jchambers closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
@petarov
Copy link
Contributor

petarov commented Feb 1, 2024

I added the jvm parameter - Djava.net. preferIPv4Stack=true. domain name is no longer resolved ipv6, there is no problem for the time being. Thanks.

Funny, this seems to have solved it on my side as well. Then I removed the parameter and everything worked fine. A bit later I decided to set -Djava.net.preferIPv6Addresses=true and the No route to host problem came back.

Curl seems to work fine, so to me this looks like a combination of a JVM and local network-specific issue.

curl -6 "https://api.push.apple.com"
{"reason":"MethodNotAllowed"}

I have this problem only on my dev environment thus far (macOS) and thought I'd share even though the issue has been closed.

@nkavian
Copy link

nkavian commented Mar 3, 2025

I've been using System.setProperty("java.net.preferIPv4Stack", "true"); and intermittently this issue still happens.

At the moment, it's still trying to use IPv6 when told not to.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.eatthepath.pushy.apns.ApnsClient]: Factory method 'developmentApnsClient' threw exception; nested exception is java.lang.ExceptionInInitializerError
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 96 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
	at com.eatthepath.pushy.apns.ApnsChannelFactory.<init>(ApnsChannelFactory.java:84)
Caused by: java.lang.IllegalArgumentException: cannot use an unresolved DNS server address: [fe80::f01f:c7ff:fe96:b664%en0]:53
	at io.netty.resolver.dns.DnsServerAddresses.sanitize(DnsServerAddresses.java:174)

@petarov
Copy link
Contributor

petarov commented Mar 4, 2025

@nkavian I don't think you can set this property at runtime via System.setProperty. It must be passed as JVM parameter before the JVM starts i.e. -Djava.net.preferIPv6Addresses=true.

@jmason
Copy link

jmason commented Mar 4, 2025

It appears the IPV4 one can be set at runtime, but you need to do it early -- cf https://stackoverflow.com/questions/9882357/how-to-set-java-net-preferipv4stack-true-at-runtime#comment105040174_9882413

@nkavian
Copy link

nkavian commented Mar 4, 2025

I do set it early, in the Spring Boot application before it creates the actual SpringApplication.

I did realize something interesting yesterday. The problem happened when I tethered my laptop to my iPhone for internet access. Once I reconnected at home, Pushy/Netty stopped that specific issue.

Then it reverted to the previous intermittent issue which I have been ignoring:

Caused by: java.lang.UnsatisfiedLinkError: io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.resolvers()[Lio/netty/resolver/dns/macos/DnsResolver;
	at io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.resolvers(Native Method)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants