Skip to content

Commit 7ee2744

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Issue 90868. Fix race condition in PluginManager.addPluginToContextRoot
1. We start stopping the plugin in removedContextRoot. 2. We add the plugin to the map in addPluginToContextRoot. 3. We receive the notification that the plugin stopped, and remove the plugin by its path from the map. The issue is that the map has already been updated to contain the newly started plugin, with the same path. As a result, we forget that we have a plugin started, and never stop it. Bug: flutter/flutter#90868 Change-Id: I46c294c555905f0e9f298044718b281cb890e8ac Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214862 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent fa428da commit 7ee2744

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,10 @@ class PluginManager {
330330
try {
331331
var session = await plugin.start(byteStorePath, sdkPath);
332332
session?.onDone.then((_) {
333-
_pluginMap.remove(path);
334-
_notifyPluginsChanged();
333+
if (_pluginMap[path] == plugin) {
334+
_pluginMap.remove(path);
335+
_notifyPluginsChanged();
336+
}
335337
});
336338
} catch (exception, stackTrace) {
337339
// Record the exception (for debugging purposes) and record the fact

0 commit comments

Comments
 (0)