-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Description
Spring Boot Version: 3.5.6
Expected Behavior
Setting the management.metrics.web.client.max-uri-tags property should prevent memory leaks. So should setting the management.metrics.enable.http.client.requests property to false.
Actual Behavior
Neither property prevents a memory leak because under certain conditions, the AutoConfiguredCompositeMeterRegistry will accumulate unbounded entries in its meterMap because no MeterFilters are being applied to it. This leads to the eventual exhaustion of heap memory and causes the application to crash.
Replication
- start the attached sample-project
- send a couple hundred requests to it via curl:
for i in {1..200}; do curl http://localhost:8080/test; done - notice the log event in the console:
OnlyOnceLoggingDenyMeterFilter : Reached the maximum number of URI tags for 'http.client.requests'. Are you using 'uriVariables'? - capture a heap dump via
/actuator/heapdump - analyze the heap dump and see
- the number of elements in the
meterMapfor theAutoConfiguredCompositeMeterRegistrygrows and grows - the number of elements in the
meterMapfor thePrometheusMeterRegistryis static (does not grow and grow)
- the number of elements in the
Conditions:
- more than one meter registry is configured
- the attached sample is using
micrometer-registry-prometheus+micrometer-registry-jmxbut it could be any combination of two or more.
- the attached sample is using
- the application is generating unique metrics / tags
- for example: using a
RestClientto call a URI without proper use of URI variables (that's the case in the provided sample)
- for example: using a
possible cause: 9f21413
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug