Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jyameo
Copy link
Contributor

@jyameo jyameo commented Jun 17, 2025

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:

  • Track active appIds in a Set _activeListeners
  • Only create stdout listeners if not already listening for that appId
  • Clean up tracking when connections end

Changes
app_domain.dart: Added listener deduplication with minimal code changes

Result

  • Single log event per refresh (no more duplicates)
  • All debugging functionality preserved
  • No breaking changes

This reverts commit 2ccd2d9.
@jyameo jyameo mentioned this pull request Jun 17, 2025
@jyameo jyameo changed the title Fix duplicate connection/logs Fix duplicate connection/logs in Webdev Jun 17, 2025
Copy link

auto-submit bot commented Jun 19, 2025

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.

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

Successfully merging this pull request may close these issues.

Bug: Webdev duplicates app connections for each refresh.
1 participant