Skip to content

Conversation

@flutteractionsbot
Copy link

@flutteractionsbot flutteractionsbot commented Mar 27, 2025

This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

Issue Link:

#161466

Changelog Description:

flutter/161466: Fixed issue where hot restart could hang indefinitely if "Pause on Unhandled Exceptions" was enabled and a call to Isolate.run had not completed.

Impact Description:

Hot restart (and the Dart-Code extension) could end up in a bad state where hot restart never completes and interacting with the application via the Dart-Code extension doesn't work as expected. The application becomes unresponsive and must be fully restarted to continue development.

Isolate.run is used to load license files in the background, meaning that users don't need to explicitly be spawning isolates to encounter this issue.

Workaround:

Is there a workaround for this issue?

Explicitly disable "Pause on Unhandled Exceptions", which is typically enabled by default.

Risk:

What is the risk level of this cherry-pick?

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

  1. Create a Flutter project with the following main.dart:
  import 'dart:async';
  import 'dart:developer';
  import 'dart:isolate';

  import 'package:flutter/material.dart';

  void main() {
    WidgetsFlutterBinding.ensureInitialized().platformDispatcher.onError = (Object error, StackTrace? stack) {
      return true;
    };
    runApp(
      const Center(
        child: Text(
          'Hello, world!',
          key: Key('title'),
          textDirection: TextDirection.ltr,
        ),
      ),
    );

    Isolate.run(() {
      print('COMPUTING');
      debugger();
    });
  }
  1. Run the application in debug mode and perform a hot restart once COMPUTING appears on stdout. Hot restart should complete successfully.

@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Mar 27, 2025
@flutteractionsbot
Copy link
Author

@bkonyi please fill out the PR description above, afterwards the release team will review this request.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 27, 2025
@reidbaker
Copy link
Contributor

@bkonyi Please add a changelog entry following our changelog guidance.

@bkonyi
Copy link
Contributor

bkonyi commented Apr 9, 2025

@bkonyi Please add a changelog entry following our changelog guidance.

Done.

CHANGELOG.md Outdated
### [3.29.3](https://github.com/flutter/flutter/releases/tag/3.29.3)
- [flutter/165166](https://github.com/flutter/flutter/pull/165166) - Impeller,
All platforms, Text that is scaled over 48x renders incorrectly.
- [flutter/161466](https://github.com/flutter/flutter/pull/161466) - Fixed issue where hot restart could hang indefinitely if "Pause on Unhandled Exceptions" was enabled and a call to `Isolate.run` had not completed.
Copy link
Contributor

Choose a reason for hiding this comment

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

@bkonyi This doesn't follow our changelog guidance.

https://github.com/flutter/flutter/blob/master/docs/releases/Hotfix-Documentation-Best-Practices.md

Here is my best attempt at the entry.

Suggested change
- [flutter/161466](https://github.com/flutter/flutter/pull/161466) - Fixed issue where hot restart could hang indefinitely if "Pause on Unhandled Exceptions" was enabled and a call to `Isolate.run` had not completed.
- [flutter/161466](https://github.com/flutter/flutter/pull/161466) -When "Pause on Unhandled Exceptions" is enabled in VsCode hot restart can hang on all platforms.

Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't solely a VSCode issue. How about:

Hot restart can hang on all platforms if "Pause on Unhandled Exceptions" is enabled by the debugger and a call to `Isolate.run` has not completed.

Copy link
Contributor

Choose a reason for hiding this comment

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

As a flutter dev I dont immediately understand what "and a call to Isolate.run has not completed" means or what that looks like to a user.

That said you are the author.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be fair, there's a lot of entries in recent change logs that I don't understand as a Flutter developer... 😄

I think this is the simplest the description can be without losing important context.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 9, 2025

autosubmit label was removed for flutter/flutter/166064, because Pull request flutter/flutter/166064 is not in a mergeable state.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 10, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 10, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 10, 2025

autosubmit label was removed for flutter/flutter/166064, because - The status or check suite Linux framework_tests_widgets has failed. Please fix the issues identified (or deflake) before re-applying this label.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 10, 2025
@auto-submit auto-submit bot merged commit cf56914 into flutter:flutter-3.29-candidate.0 Apr 10, 2025
149 of 150 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
Fintasys pushed a commit to Fintasys/flutter that referenced this pull request May 14, 2025
…on in UI isolates on hot restart (flutter#166064)

This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

### Issue Link:

flutter#161466

### Changelog Description:

[flutter/161466](flutter#161466): Fixed issue where hot restart could hang indefinitely if "Pause on Unhandled Exceptions" was enabled and a call to `Isolate.run` had not completed.

### Impact Description:

Hot restart (and the Dart-Code extension) could end up in a bad state where hot restart never completes and interacting with the application via the Dart-Code extension doesn't work as expected. The application becomes unresponsive and must be fully restarted to continue development.

`Isolate.run` is used to load license files in the background, meaning that users don't need to explicitly be spawning isolates to encounter this issue.

### Workaround:
Is there a workaround for this issue?

Explicitly disable "Pause on Unhandled Exceptions", which is typically enabled by default.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
What are the steps to validate that this fix works?

1. Create a Flutter project with the following `main.dart`:

```dart

  import 'dart:async';
  import 'dart:developer';
  import 'dart:isolate';

  import 'package:flutter/material.dart';

  void main() {
    WidgetsFlutterBinding.ensureInitialized().platformDispatcher.onError = (Object error, StackTrace? stack) {
      return true;
    };
    runApp(
      const Center(
        child: Text(
          'Hello, world!',
          key: Key('title'),
          textDirection: TextDirection.ltr,
        ),
      ),
    );

    Isolate.run(() {
      print('COMPUTING');
      debugger();
    });
  }
```

2. Run the application in debug mode and perform a hot restart once `COMPUTING` appears on `stdout`. Hot restart should complete successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants