Skip to content

Increasing memory usage from Spring Security Observation due to the metric "spring.security.filterchains.active" #14030

@pengxo

Description

@pengxo

Describe the bug
We use Spring Boot version is 3.1.4 with Webflux as well as Spring Cloud Gateway for our application. The metric called spring.security.filterchains.active holds a increasing number of activeTasks in the metric DefaultLongTaskTimer from Micrometer. It seems that the instrumentation from Spring Security does not stop the active tasks such that the number of activeTasks keeps increasing. We have observed more than 8 million activeTasks for this metric. However, we don't have issue with other metrics from Spring Security such as spring.security.authorizations. Please see the screenshots about heapdump analysis below:
image

This happens in our production environments in which there are relatively high request amount.
To Reproduce
I tried to reproduce it locally and I have not made it successfully. More information could also be found in this issue micrometer-metrics/micrometer#4221

Expected behavior
Only a small amount of activeTasks are stored for the metric as it only keeps the active requests going through the security filter chains.

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)status: duplicateA duplicate of another issuetype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions