更新 Spring Boot Parent 后的 PortUnreachableExceptions 垃圾邮件日志

PortUnreachableExceptions spamming log after updating Spring Boot Parent

spring-boot-parent 版本 2.5.5 升级到 2.6.0 后,我开始在日志中看到这些错误消息:

[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

使用 DEBUG 级别:

[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.access0(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.run(SingleThreadEventExecutor.java:986)
[INFO] [stdout]     at io.micrometer.shaded.io.netty.util.internal.ThreadExecutorMap.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

我在 release notes 中找不到太多相关信息,除了似乎相关的依赖项升级:

Upgrade to Micrometer 1.8.0 #28516

但是链接的问题没有提供信息。 Micronaut 自己的 release notes for version 1.8.0 也不是(除了 JVM 崩溃通知,我们已经 运行 进入了 - 升级 Spring 引导的令人惊讶且相当不幸的副作用,但我离题了)

我们不(有意识地)使用 Micrometer,所以我尝试在 application.yml 文件(micrometer.enabled: falseinstrumentation.micrometer.enabled: false)中禁用它,但无济于事。

尽管进行了大量谷歌搜索(针对错误消息元素的各种排列并挖掘 GitHub 上的代码),但我仍无法找到修复此消息的方法,更不用说弄清楚是什么了导致它。

现在我当然可以在日志记录配置中抑制这条消息,但我想知道它实际上试图在这里实现什么,以及它是否对我们的应用程序有用。如果没有,请完全禁用它。

假设您没有使用和配置 statsd,因为它指向本地主机,您可以通过设置

禁用它
management.metrics.export.statsd.enabled

为假