Skip to content

Conversation

@lionel-
Copy link
Contributor

@lionel- lionel- commented Dec 4, 2025

Progress towards #10121

Logs involving the session manager are a bit confusing because sessions are never cleaned up, and so the manager keeps trying to deactivate LSP in sessions that no longer exist. This also causes it hold onto RSession objects, preventing garbage collection.

To fix this:

  • RSession gains a register() method for external resources that should be cleaned up when the session is disposed of.
  • The manager's event handler is now registered in RSession, instead of the singleton's own disposables.
  • The manager no longer maintains a list of session and instead queries the main thread for active sessions. Because of this process crossing a bunch of methods are now async.

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

@:ark

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:ark

readme  valid tags

@lionel- lionel- force-pushed the task/r-session-cleanup branch from 4ebf876 to baf0589 Compare December 4, 2025 13:05
const session = sessions.find(s => s.metadata.sessionId === sessionId);
if (!session) {
// The foreground session is for another language.
// The foreground session is for another language or was deactivated in the meantime
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the await, the session might no longer exist.

}

this._lastForegroundSessionId = session.metadata.sessionId;
await this.activateConsoleSession(session, 'foreground session changed');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like multiple activateConsoleSession() might run concurrently if the didChangeForegroundSession event fires rapidly. We might want to queue the handling.

await vscode.commands.executeCommand('_extensionTests.setLogLevel', 'trace');
// Set global Positron log level to debug on CI for easier debugging
if (process.env.CI) {
await vscode.commands.executeCommand('_extensionTests.setLogLevel', 'debug');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think trace was nice?

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.

3 participants