Skip to content

[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
merged 2 commits into from
Aug 15, 2025

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Aug 14, 2025

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.

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 srujzs requested review from nshahan and jyameo August 14, 2025 22:47
@srujzs srujzs changed the title [dwds] Fix bug where no-op hot restart doesn't cancel a subscription [dwds] Fix bug where no-op hot restart doesn't cancel a subscription and publish 25.0.1 Aug 14, 2025
Copy link
Contributor

@jyameo jyameo left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor

@nshahan nshahan left a comment

Choose a reason for hiding this comment

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

LGTM Thanks!

@srujzs srujzs merged commit b947357 into dart-lang:main Aug 15, 2025
47 checks passed
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.

3 participants