Skip to content

iOS app crashes when camera is streaming images #44436

@rsfarias

Description

@rsfarias

iOS app is being terminated when camera streams images after a few seconds. I'm using the camera plugin, up to date.

This problem occurred after I cherry-picked 9769754 to fix a severe black screen bug. I also tried to use the current beta, and the problem also occurs.

Stable channel is fine, no crashes.

Steps to Reproduce

  1. Download the example app from the camera plugin.
  2. Create the following function in main.dart:
void _startStreamingImages() {
    controller.startImageStream((CameraImage image) {
      print('Got image... It will crash in a few seconds.');
    });
}
  1. Call the function above after initializing the controller (line 205):
try {
      await controller.initialize();
      _startStreamingImages();
    } on CameraException catch (e) {
      _showCameraException(e);
}
  1. Run the app and tap on the camera icon on the bottom left to start the camera.

Target Platform: iOS
Android seems to not crash.

Logs

When run in VS Code, the app just crashes without an explanation, but when run in Xcode we get an error message "Terminated due to memory issue".

[        ] Updating files
[ +354 ms] DevFS: Sync finished
[        ] Syncing files to device iPhone de Rafael... (completed in 3,129ms, longer than expected)
[   +1 ms] Synced 0.8MB.
[   +2 ms] Sending to VM service: _flutter.listViews({})
[   +5 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0x10382ea20, isolate: {type: @Isolate, fixedId: true, id:
isolates/2382924456970743, name: main.dart$main-2382924456970743, number: 2382924456970743}}]}
[   +1 ms] <- accept
[        ] Connected to _flutterView/0x10382ea20.
[   +4 ms] 🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
[        ] An Observatory debugger and profiler on iPhone de Rafael is available at: http://127.0.0.1:1112/2qM_6d78MMc=/
[        ] For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
[+67235 ms] Service protocol connection closed.
[   +1 ms] Lost connection to device.
[   +2 ms] DevFS: Deleting filesystem on the device
(file:///private/var/mobile/Containers/Data/Application/3C38DC63-3607-4510-B793-36A7E93E0F3A/tmp/examplengw0kp/example/)
[        ] Sending to VM service: _deleteDevFS({fsName: example})
[ +257 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +4 ms] "flutter run" took 119,432ms.
| => flutter analyze
Analyzing example...                                                    
No issues found! (ran in 6.6s)
| => flutter doctor -v
[✓] Flutter (Channel unknown, v1.9.1+hotfix.7-pre.1, on Mac OS X 10.14.6 18G103, locale en-US)
    • Flutter version 1.9.1+hotfix.7-pre.1 at /Users/rfarias/marklii/dev/tools/flutter
    • Framework revision 2f4d8032ee (2 months ago), 2019-08-29 19:12:41 -0400
    • Engine revision 9a17d8e451
    • Dart version 2.5.0 (build 2.5.0-dev.3.0 35382f9b14)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/rfarias/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2, Build version 11B52
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[✓] Connected device (1 available)
    • iPhone de Rafael • 89145d765c207c1177e7c84d57620d60d9d93cac • ios • iOS 11.2.1

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processc: renderingUI glitches reported at the engine/skia or impeller rendering levelp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions