Skip to content

API example smoke test failing silently #144353

Closed

Description

@Piinks

Noticed in a build log:
https://ci.chromium.org/ui/p/flutter/builders/try/Windows%20framework_tests_misc/56887/overview

00:07 +80: Smoke test material/color_scheme/color_scheme.0.dart
00:08 +81: Smoke test material/color_scheme/dynamic_content_color.0.dart
00:08 +82: Smoke test material/context_menu/context_menu_controller.0.dart
00:08 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#0cf43(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:08 +83: Smoke test material/context_menu/editable_text_toolbar_builder.0.dart
00:08 +84: Smoke test material/context_menu/editable_text_toolbar_builder.1.dart

But this did not cause the test shard to fail. Should the build have failed here? (also we should fix the test)

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    frameworkflutter/packages/flutter repository. See also f: labels.
    d: api docsIssues with https://api.flutter.dev/
    fyi-infraFor the attention of Infrastructure team
    on Feb 29, 2024
  2. goderbauer commented on Mar 6, 2024

    @goderbauer
    Member

    It's failing here:

    // Well this is not a good sign.
    // Ideally, once the test has failed we would stop getting errors from the test.
    // However, if someone tries hard enough they could get in a state where this happens.
    // If we silently dropped these errors on the ground, nobody would ever know. So instead
    // we report them to the console. They don't cause test failures, but hopefully someone
    // will see them in the logs at some point.

    So, it is expected that it is not failing the test. I wonder why we decided to not have them fail the test execution as a whole, though.

  3. self-assigned this
    on Mar 6, 2024
  4. github-actions commented on Mar 26, 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.

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

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions