Skip to content

Assertion error "Trying to render a disposed EngineFlutterView" (on flutter web, master channel) #141253

Closed

Description

@LeoRc01

Steps to reproduce

  1. Start a WEB application
  2. Press "Hot restart" button (testing on Android Studio)

Expected results

App restarts successfully

Actual results

App doesn't restart and throws assertion error as shown in the logs below.

Code sample

On every code base

Screenshots or Video

No response

Logs

Logs
======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
Assertion failed: org-dartlang-sdk:///lib/_engine/engine/window.dart:91:12
!isDisposed
"Trying to render a disposed EngineFlutterView."

When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3       throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 38:3        assertFailed
lib/_engine/engine/window.dart 91:13                                              render
packages/flutter/src/rendering/view.dart 309:7                                    compositeFrame
packages/flutter/src/rendering/binding.dart 582:19                                drawFrame
packages/flutter/src/widgets/binding.dart 991:13                                  drawFrame
packages/flutter/src/rendering/binding.dart 443:5                                 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1386:7                                [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1311:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1169:5                                [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1346:5                                invoke
lib/_engine/engine/platform_dispatcher.dart 260:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 185:36                                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39  dcall
====================================================================================================

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.19.0-3.0.pre.25, on macOS 14.2.1 23C71 darwin-arm64, locale it-IT)
    • Flutter version 3.19.0-3.0.pre.25 on channel master at /Users/leonardo/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a103002496 (3 hours ago), 2024-01-10 02:02:12 -0500
    • Engine revision 7e6f3d847e
    • Dart version 3.4.0 (build 3.4.0-11.0.dev)
    • DevTools version 2.31.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/leonardo/Library/Android/sdk
    • Platform android-34, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0

[✓] Connected device (3 available)
    • iPhone di Leonardo (mobile) • 00008120-000638C03AF3C01E • ios            • iOS 17.3 21D5026f
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 120.0.6099.216

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. darshankawar commented on Jan 10, 2024

    @darshankawar
    Member

    @LeoRc01 Thanks for the report. I am unable to replicate it after running a sample code on web from AS using latest master channel and then hot restarting it which works as expected. No errors were received.
    Are there any specific steps or pattern that leads to the error. Does the error occur in canvaskit mode only or in html rendering as well ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 10, 2024
  3. LeoRc01 commented on Jan 10, 2024

    @LeoRc01
    Author

    @danagbemava-nc @darshankawar thank you for your time and answers.

    • Testing on CLI and VSCode doesn't throw any error but the application won't change, as shown in the video below.

    • Testing on AS it throws the error as mentioned in the issue.

    Android Studio video
    65868d05-a19a-4d14-9ae1-182123003a94.mp4
    VSCode video
    a5a5a01e-9fee-41fb-8006-9f9ca9415ee3.mp4
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 10, 2024
  5. darshankawar commented on Jan 11, 2024

    @darshankawar
    Member

    Thanks for the update. I think this is similar to #140684, so please follow-up in it for further updates. Closing this as a duplicate.

  6. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Jan 11, 2024
  7. github-actions commented on Jan 25, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Jan 25, 2024
  9. pedromassango commented on Mar 8, 2024

    @pedromassango
    Member

    Still happening

  10. unlocked this conversation on Mar 10, 2024
  11. gjlmotea commented on Mar 10, 2024

    @gjlmotea

    Encountered the same problem, it only occurs on the web.
    Works fine on mobile platform.
    (flutter doctor -v status is ok)

  12. 4 remaining items

  13. pedromassango commented on Mar 12, 2024

    @pedromassango
    Member

    @pedromassango @gjlmotea What is Flutter version you see the issue?

    I'm on stable channel.

    The following assertion was thrown during a scheduler callback:
    Assertion failed: org-dartlang-sdk:///lib/_engine/engine/window.dart:91:12
    !isDisposed
    "Trying to render a disposed EngineFlutterView."
    
    When the exception was thrown, this was the stack: 
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3       throw_
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 38:3        assertFailed
    lib/_engine/engine/window.dart 91:13                                              render
    packages/flutter/src/rendering/view.dart 256:7                                    compositeFrame
    packages/flutter/src/rendering/binding.dart 587:19                                drawFrame
    packages/flutter/src/widgets/binding.dart 991:13                                  drawFrame
    packages/flutter/src/rendering/binding.dart 448:5                                 [_handlePersistentFrameCallback]
    packages/flutter/src/scheduler/binding.dart 1386:7                                [_invokeFrameCallback]
    packages/flutter/src/scheduler/binding.dart 1311:9                                handleDrawFrame
    packages/flutter/src/scheduler/binding.dart 1169:5                                [_handleDrawFrame]
    lib/_engine/engine/platform_dispatcher.dart 1346:5                                invoke
    lib/_engine/engine/platform_dispatcher.dart 260:5                                 invokeOnDrawFrame
    lib/_engine/engine/initialization.dart 185:36                                     <fn>
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37  _checkAndCall
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39  dcall
    ====================================================================================================
    
    
  14. huycozy commented on Mar 14, 2024

    @huycozy
    Member

    I'm on stable channel.

    This should be fixed on the latest beta or master channels, you can try switching to these channels and re-check it.

  15. r-durao-pvotal commented on Mar 20, 2024

    @r-durao-pvotal

    I'm on stable channel.

    This should be fixed on the latest beta or master channels, you can try switching to these channels and re-check it.

    Tried running the sample counter app on the master channel. This issue specifically seems to not be happening anymore, but I'm seeing another error being logged this time around:

    Error: TypeError: Instance of 'UniqueRef<JavaScriptObject>': type 'UniqueRef<JavaScriptObject>' is not a subtype of type 'JSObject'
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3       throw_
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1388:3                              _failedAsCheck
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1366:3                              _generalAsCheckImplementation
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 243:33  _argumentErrors
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 422:22  _checkAndCall
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 431:39  dcall
    Error: TypeError: Instance of 'UniqueRef<JavaScriptObject>': type 'UniqueRef<JavaScriptObject>' is not a subtype of type 'JSObject'
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3       throw_
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1388:3                              _failedAsCheck
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1366:3                              _generalAsCheckImplementation
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 243:33  _argumentErrors
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 422:22  _checkAndCall
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 431:39  dcall
    Error: TypeError: Instance of 'UniqueRef<JavaScriptObject>': type 'UniqueRef<JavaScriptObject>' is not a subtype of type 'JSObject'
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3       throw_
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1388:3                              _failedAsCheck
    dart-sdk/lib/_internal/js_shared/lib/rti.dart 1366:3                              _generalAsCheckImplementation
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 243:33  _argumentErrors
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 422:22  _checkAndCall
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 431:39  dcall
    
    octor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel master, 3.21.0-11.0.pre.52, on macOS 14.2.1 23C71 darwin-arm64, locale en-PT)
    [!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
    [!] Xcode - develop for iOS and macOS (Xcode 15.3)
        ✗ Unable to get list of installed Simulator runtimes.
        ! CocoaPods 1.12.1 out of date (1.13.0 is recommended).
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2021.2)
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
    [✓] VS Code (version 1.87.2)
    [✓] Connected device (3 available)
    [✓] Network resources
    
  16. mbecroft commented on Mar 20, 2024

    @mbecroft

    Exactly the same errors here when running in Chrome in debug mode after switching to master channel.

    IGNORE THE BELOW, my hot reload issue was simply a stupid error on my part with time synchronisation. I did see the same JS errors when on master though.


    As of the last week or so, I have not been able to hot reload or restart - making development work almost impossible.

    I also tested with Linux native, and while I get no error messages, hot reload and hot restart do not work.

    To be clear, hot reload and hot restart do have an effect (especially with hot restart, you can see the screen be redrawn). The issue is that code changes have no effect.

    Given this problem arose since a flutter update from a couple of weeks ago, I am thinking of downgrading to see if that fixes it.

  17. huycozy commented on Mar 21, 2024

    @huycozy
    Member

    @r-durao-pvotal I also can reproduce that issue on master channel. Filed it here in dart repo: dart-lang/sdk#55256

  18. r-durao-pvotal commented on Mar 21, 2024

    @r-durao-pvotal

    @huycozy do you have an estimate on when this issue will be tackled? This severely hinders web app development using flutter. Having to re-run the app every time we want to test a change is extremely time consuming

  19. huycozy commented on Mar 21, 2024

    @huycozy
    Member

    @r-durao-pvotal I'm not sure, but usually issues like this will be noticed quickly (within a day)

  20. nialljawad96 commented on Mar 22, 2024

    @nialljawad96

    This is a shambles. Disabling issues on both master and stable channels

  21. pedromassango commented on Mar 22, 2024

    @pedromassango
    Member

    Closing as this isn't happening on master.

  22. added
    r: fixedIssue is closed as already fixed in a newer version
    and removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on Mar 25, 2024
  23. github-actions commented on Apr 11, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  24. locked as resolved and limited conversation to collaborators on Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions