Skip to content

Fix FlutterOutline service infinite subscriptions #8057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2025

Conversation

pq
Copy link
Contributor

@pq pq commented Apr 14, 2025

Fixes an issue where we never unsubscribe outline listeners.

The rub is that getLocalFileUri is being called on a path that is already a URI and is producing a bogus path which has no associated listener registered (because it’s bogus).

In general the issue here is a symptom of URIs being encoded in strings that are never validated.

The quick fix is to not “uri-ify” an already valid UR string. Longer term we should consider a deeper audit of places we’re passing URIs around. It’s possible there are other related issues. If/when we do this, Alex shared some interesting thoughts from his work on the Dart plugin that’d be worth synthesizing.

Fixes: #7980

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@pq
Copy link
Contributor Author

pq commented Apr 14, 2025

@jwren: holding off on changelog changes until #8056 lands, or you can edit that directly?

I'd add a line like:

- Fix Flutter Outline View event over-subscriptions (#7980)

(Or similar)

@jwren
Copy link
Member

jwren commented Apr 14, 2025

Thanks @pq -- I'll update the changelog PR. This change was successful in the presubmits, landing it now.

@jwren jwren self-requested a review April 14, 2025 19:18
@pq
Copy link
Contributor Author

pq commented Apr 14, 2025

(Updated branch.)

@@ -132,8 +132,7 @@ private void updateActiveEditors() {
}

for (final String path : obsoletePaths) {
final String filePathOrUri = getAnalysisServer().getAnalysisService().getLocalFileUri(path);
final FlutterOutlineListener listener = outlineListeners.remove(filePathOrUri);
final FlutterOutlineListener listener = outlineListeners.remove(path);
Copy link
Member

Choose a reason for hiding this comment

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

As a follow up, reference the issue that is "fixed" with the line of code written like this, to allow more transparency to what is going on and the sensitive nature of this particular code.

@jwren jwren self-requested a review April 14, 2025 19:22
@jwren jwren merged commit 99b9f2b into flutter:master Apr 14, 2025
8 of 9 checks passed
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.

"flutter.setSubscriptions" call never forgets a file (aka will ask about an ever growing number of files)
2 participants