Endless loop in SimpleObservation.getLastScope (original) (raw)

Describe the bug
Our client hits an endless loop in
at io.micrometer.observation.SimpleObservation$SimpleScope.getLastScope(SimpleObservation.java:327)
which is here

Currently this only happens in the production environment of our client and we cannot reproduce it anywhere else (yet).
A related stacktrace showing the context of the call (from the Hibernate saveAll() method) is attached.

Environment

To Reproduce
The only "reproducer" we have is in the client's production environment.

Expected behavior
I can only suspect that because of a memory visibility issue in a concurrent environment the thread that executes the while loop does not ever see the end of the scope list. One would expect that the scope list does have a proper end and the while loop should stop there.

Additional context
The related stacktrace from a thread dump showing the context of the call which is the Hibernate saveAll() method.
As can be seen the DataSource is wrapped into a net.ttddyy proxy.
20250430-stacktrace-SimpleObservation-327-full.txt