Skip to content

Conversation

@tgrzej-avaloq
Copy link

@tgrzej-avaloq tgrzej-avaloq commented Jul 29, 2025

As the issue mentions: there is more that one DB connection handled by a particular thread and the connections are not closed in the expected order causing residual scopes to be left in the SimpleObservationRegistry (this is a memory leak plus it leads to CPU saturation with time). In the issue it is because of the specific Spring transaction handling workflow coupled with the fact that one connection is handled through the SimpleJdbc and the other one through the EntityManager. In my opinion the order of closing DB connections should be for a particular application code to decide without the observation framework imposing hard requirements.

This PR does not fix the underlying problem which I think is handling disjoint scope hierarchies. It just attempts to prevent the long term corruption of the scope list in the SimpleObservationRegistry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant