Netty 'spring.netty-leak-detection' default property value is always applied to ResourceLeakDetector
See original GitHub issueSpring will override the Netty leak detection level set using -Dio.netty.leakDetection.level=advanced
The code below want to set leak detection if property was not null. But the property has default value as SIMPLE. This will get leak detection overridden as SIMPLE always if you set it other value like ‘advanced’ outside of Spring
public class NettyProperties {
private LeakDetection leakDetection = LeakDetection.SIMPLE;
...
public class NettyAutoConfiguration {
public NettyAutoConfiguration(NettyProperties properties) {
if (properties.getLeakDetection() != null) {
NettyProperties.LeakDetection leakDetection = properties.getLeakDetection();
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.valueOf(leakDetection.name()));
}
}
}
...
changed to
if (properties.getLeakDetection() != LeakDetection.SIMPLE) {
will solve the problem as LeakDetection will be simple if not set.
Happy to raise a PR if this is
Version: current main branch
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Netty 'spring.netty leak detection' default property value is ...
Netty 'spring.netty leak detection' default property value is always applied to resource leak detector #32145.
Read more >spring default property values always default to second
Properties (first.value and last.value) are being loaded as such: <context:property-placeholder location="classpath:com/test/testing.properties ...
Read more >Common Application Properties - Spring
Name Description Default...
spring.cassandra.config Location of the configuration file to use.
spring.cassandra.controlconnection.timeout Timeout to use for control queries. 5s
spring.cassandra.keyspace‑name Keyspace name to use.
Read more >Spring Boot アプリケーションプロパティ設定一覧
生成された git.properties ファイルの場所。 classpath:git.properties. spring.jmx.default-domain. JMX ドメイン名。
Read more >Spring Boot Reactor Netty Configuration - Baeldung
In this tutorial, we're going to look at different configuration options for a Reactor Netty server in a Spring Boot application.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We’re going to change the default value in
NettyPropertiestonulland update the description to indicate that when not set the Netty default (which is SIMPLE) will be used.I think I’ve changed my mind. Developers can configure this with:
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);-Dio.netty.leakDetection.level=paranoidThe configuration property should only apply if a specific value has been set, so setting the default value to
nullmight be a good compromise. With all 3 ways involved, we’re always going to find a combination that leads to strange results. This is why we initially declined #14338.Even with this solution, if
ResourceLeakDetector.setLevel()is called within a bean, the configuration property will be overridden. This could be a breaking change if our configuration property currently shadows an existing system property - upgrading Spring Boot might change the resulting behavior.