-
Notifications
You must be signed in to change notification settings - Fork 83
Fix duplicate connection/logs in Webdev #2635
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
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 2ccd2d9.
autosubmit label was removed for dart-lang/webdev/2635, because - The status or check suite publish / validate has failed. Please fix the issues identified (or deflake) before re-applying this label. |
@@ -121,8 +111,7 @@ class AppDomain extends Domain { | |||
appConnection.runMain(); | |||
|
|||
unawaited(debugConnection.onDone.whenComplete(() { | |||
appState.dispose(); | |||
_appStates.remove(appId); | |||
_cleanupAppConnection(appId, appState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this result in the streams being cancelled once the first DebugConnection
closes, even if a more recent connection to the same appId
has been established?
Fix duplicate app logs on page refresh in Webdev
Fixes: #2604
Problem
Each page refresh created duplicate stdout listeners for the same app, causing exponential log duplication (1 log → 2 logs → 3 logs, etc.).
Root Cause
app_domain.dart created new VM service stdout listeners on every dwds.connectedApps event without checking if listeners already existed for the same appId.
Solution
Added simple tracking to prevent duplicate listeners:
Changes
app_domain.dart: Added listener deduplication with minimal code changes
Result