Skip to content

Conversation

@VietND96
Copy link
Member

Summary

  • track recently removed sessions in LocalSessionMap so the grid can report when and why a session disappeared
  • propagate removal causes from node events and explicit removals into diagnostic logging
  • extend LocalSessionMapTest to verify the user-facing exception text contains the removal reason

Testing

  • bazel test //java/test/org/openqa/selenium/grid/sessionmap/local:LocalSessionMapTest

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 130 to +144
Session session = knownSessions.get(id);
if (session == null) {
SessionRemovalInfo removalInfo = removalHistory.get(id);
if (removalInfo != null) {
Instant now = Instant.now();
if (removalInfo.isExpired(now)) {
removalHistory.remove(id, removalInfo);
} else {
long secondsAgo = Math.max(0, removalInfo.secondsSince(now));
throw new NoSuchSessionException(
String.format(
"Session ID: %s was closed %d second(s) ago. Reason: %s",
id, secondsAgo, removalInfo.reason));
}
}

Choose a reason for hiding this comment

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

P1 Badge Prevent unbounded growth of removal history cache

The new removalHistory cache records every deleted session so get can report a reason (lines 132‑144), but entries are only dropped when a get call for that specific id happens or the id is re-added. In typical operation most sessions are never queried again after removal, so this map will accumulate all historic session ids despite the one-hour retention constant and will grow without bound on a long-lived grid node. Consider pruning expired entries when recording removals or with a periodic cleanup to avoid a memory leak.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants