Skip to content

[camera] integration test failed because of thread merge causing sleep to block the main thread #194397

Closed
flutter/packages
#13289

Description

@hellohuanlin
  1. Follow [iOS 27] camera_avfoundation integration tests fail for image/video resolution and image output format #191202 to run integration test for camera plugin
  2. Observe 2 of the tests (control audio/video bit rate tests) failed (sometimes got stuck when I tried it)

The test failed because this sleep:

https://github.com/flutter/packages/blob/24a3833ea0c602a64154e99d4f1ee9b420c9c714/packages/camera/camera_avfoundation/example/integration_test/camera_test.dart#L288-L297

Previously, before thread merge, this worked, because sleep only blocks the UI thread.

Now, after thread merge, the UI thread and platform thread are the same. So sleep would block all the internal setups (such as dart's event channel set up and DispatchQueue.main.async calls on the native side.

Then once sleep is done, it stops the video recording immediately.

        await controller.startVideoRecording();
        sleep(const Duration(milliseconds: 500));
        final XFile file = await controller.stopVideoRecording();

The solution is to use await Future<void>.delayed(const Duration(milliseconds: 500)); instead

Activity

  1. changed the title [-][camera] integration test hung because of thread merge causing sleep to block the main thread[/-] [+][camera] integration test failed because of thread merge causing sleep to block the main thread[/+] on Oct 14, 2026
  2. self-assigned this
    on Oct 14, 2026
  3. added
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Oct 14, 2026
  4. github-actions commented on Oct 30, 2026

    @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 Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listfyi-ecosystemFor the attention of Ecosystem teamp: cameraThe camera pluginplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions