-
Notifications
You must be signed in to change notification settings - Fork 86
[dwds] Fix bug where no-op hot restart doesn't cancel a subscription and publish 25.0.1 #2668
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In hot restart, we wait for all sources to be parsed before continuing to create the isolate. In order to do so, we listen on parsed sources by registering a subscription. In the case where we have no sources to restart, we don't cancel the subscription. This results in an issue where on the next hot restart that contains changes, the old subscription is triggered, potentially completing an already completed completer. Instead, we should always cancel the subscription. Hot reload code is changed as well to do the same. Additional checks are added to check if the completer is completed before we complete again. While this is not needed for this issue, it is possible other sources can be downloaded by the app, which may trigger the function in the listener, which could potentially try and complete the completed completer. Tests are added for both hot restart and hot reload to check that alternating empty hot restarts and non-empty hot restarts work.
srujzs
commented
Aug 15, 2025
jyameo
approved these changes
Aug 15, 2025
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.
lgtm!
nshahan
approved these changes
Aug 15, 2025
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.
LGTM Thanks!
github-merge-queue bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Aug 25, 2025
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and #173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <[email protected]>
mboetger
pushed a commit
to mboetger/flutter
that referenced
this pull request
Sep 18, 2025
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <[email protected]>
korca0220
pushed a commit
to korca0220/flutter
that referenced
this pull request
Sep 22, 2025
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <[email protected]>
Jaineel-Mamtora
pushed a commit
to Jaineel-Mamtora/flutter_forked
that referenced
this pull request
Sep 24, 2025
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In hot restart, we wait for all sources to be parsed before continuing to create the isolate. In order to do so, we listen on parsed sources by registering a subscription. In the case where we have no sources to restart, we don't cancel the subscription. This results in an issue where on the next hot restart that contains changes, the old subscription is triggered, potentially completing an already completed completer. Instead, we should always cancel the subscription. Hot reload code is changed as well to do the same.
Additional checks are added to check if the completer is completed before we complete again. While this is not needed for this issue, it is possible other sources can be downloaded by the app, which may trigger the function in the listener, which could potentially try and complete the completed completer.
Tests are added for both hot restart and hot reload to check that alternating empty hot restarts and non-empty hot restarts work.