PortUnreachableExceptions spamming log after updating Spring Boot Parent
Asked Answered
A

2

10

After upgrading from spring-boot-parent version 2.5.5 to 2.6.0, I started seeing these error messages spamming the logs:

[INFO] [stdout] 2022-01-11 13:40:01.157 WARN 76859 --- [ udp-epoll-2] i.m.s.reactor.netty.channel.FluxReceive : [6d1243de, L:/127.0.0.1:58160 - R:localhost/127.0.0.1:8125] An exception has been observed post termination, use DEBUG level to see the full stack: java.net.PortUnreachableException: readAddress(..) failed: Connection refused

Using DEBUG level:

[INFO] [stdout] 2022-01-11 13:38:29.733  WARN 76479 --- [    udp-epoll-2] i.m.s.reactor.netty.channel.FluxReceive  : [43aad7ce, L:/127.0.0.1:38108 - R:localhost/127.0.0.1:8125] An exception has been observed post termination
[INFO] [stdout] 
[INFO] [stdout] java.net.PortUnreachableException: readAddress(..) failed: Connection refused
[INFO] [stdout]     at io.micrometer.shaded.io.netty.channel.epoll.EpollDatagramChannel.translateForConnected(EpollDatagramChannel.java:575)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.channel.epoll.EpollDatagramChannel.access$400(EpollDatagramChannel.java:56)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.channel.epoll.EpollDatagramChannel$EpollDatagramChannelUnsafe.epollInReady(EpollDatagramChannel.java:503)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[INFO] [stdout]     at java.base/java.lang.Thread.run(Thread.java:833)
[INFO] [stdout] Caused by: io.micrometer.shaded.io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection refused

I can't find much about it in the release notes, except for a dependency upgrade that seems relevant:

Upgrade to Micrometer 1.8.0 #28516

But the linked issue is not informative. Neither were Micronaut's own release notes for version 1.8.0 (except for the JVM crash notice, which we did run into - a surprising and rather unfortunate side-effect of upgrading Spring Boot, but I digress)

We don't (consciously) use Micrometer, so I tried disabling it in the application.yml file (micrometer.enabled: false and instrumentation.micrometer.enabled: false), but to no avail.

Despite lots of googling (for various permutations of elements of the error message and digging through code on GitHub), I haven't been able to find how to fix this message, let alone figure out what causes it.

Now I could of course suppress this message in the logging configuration, but I'd like to know what it's actually trying to achieve here, and whether it is useful for our application. And if not, disable it completely.

Attorn answered 11/1, 2022 at 12:54 Comment(3)
Looks like it’s trying to send UDP packets to statsd (port 8125). Do you have Micrometer Statsd registry on your class path?Hetaerism
@BoristheSpider As a matter of fact, I do!Attorn
I was able to switch to a version of the company starter without statsd, and that fixes the log spam, as well as its mysterious origin.Attorn
M
13

assuming statsd is not used and configured on your side, since it's pointed to localhost, you may disable it by setting

management.metrics.export.statsd.enabled

to false

Mckinley answered 13/1, 2022 at 17:47 Comment(1)
This property path is deprecated in boot >=3.0.5. Replacement is management.statsd.metrics.export.enabledTeddy
B
13

For anyone reaching here and is the case that you migrated from Spring Boot 2 to 3, there was a change in application properties that went from

management.metrics.export.<your-integration>.*

to

management.<your-integration>.metrics.export.*

So you may need to fix that in your resource files.

source

Belong answered 10/1, 2023 at 17:43 Comment(1)
as also described here github.com/spring-projects/spring-boot/wiki/…Portentous

© 2022 - 2024 — McMap. All rights reserved.