-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I got OOM when using spring-boot-admin
after I analyze the heap dump.
I found the problem is the SimpleMeterRegistry.meterMap fill the memory and after many times GC, the map content still alive.
https://user-images.githubusercontent.com/5629307/50621747-e8d45b00-0f42-11e9-8fe2-f319a9dded80.png
I only found one way to clear the meterMap here: io.micrometer.core.instrument.MeterRegistry#close
/**
* Closes this registry, releasing any resources in the process. Once closed, this registry will no longer
* accept new meters and any publishing activity will cease.
*/
@Override
public void close() {
if (closed.compareAndSet(false, true)) {
synchronized (meterMapLock) {
for (Meter meter : meterMap.values()) {
meter.close();
}
}
}
}
In org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter
, the ·registrynot call
closeand from the name
MetricsWebFilter` I think it won't be destoried until the server close.
related code:
private void success(ServerWebExchange exchange, long start) {
Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, null);
this.registry.timer(this.metricName, tags).record(System.nanoTime() - start,
TimeUnit.NANOSECONDS);
}
I wonder where and when the timer
here be released?
I do not start a spring-boot-admin-server.
I assume that the timer not be consumed because there is no server side to fetch it ? or there is a strategy to clear these timer?
environment
spring-boot-admin-client 2.0.1
spring-boot-actuator 2.0.0 RELEASE
micrometer-core 1.0.1