Search code examples
javaspring-bootmicrometer

PortUnreachableExceptions spamming log after updating Spring Boot Parent


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.


Solution

  • 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