Skip to content

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Oct 9, 2025

We now restore the previous Observation parent after completing the Observation to avoid unintentional nesting of observations. Previously, a command became the parent of an earlier command on the same thread regardless of whether the earlier command has been finished or whether it was active.

Observation nesting now considers only commands that are still active restoring their parent after completion to avoid invalid nesting and with that, to not allocate observation graphs that allocate infinite memory.

Closes #5064

We now restore the previous Observation parent after completing the Observation to avoid unintentional nesting of observations. Previously, a command became the parent of an earlier command on the same thread regardless of whether the earlier command has been finished or whether it was active.

Observation nesting now considers only commands that are still active restoring their parent after completion to avoid invalid nesting and with that, to not allocate observation graphs that allocate infinite memory.
@Override
public boolean hasKey(Object key) {
return map.containsKey(key);
return map.get(key) != null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hard to understand policy for null values.
For stream, size, isEmpty it is regular value.
For get, hasKey it is "hidden" value

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change aligns with getOrDefault(…), it gets more pronounced when you take a look at RequestContext.getOrEmpty(…). The interface assumes that a key is only present if its value is not null.

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

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MongoObservationCommandListener causes memory leak

3 participants