Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera] MessageQueue: java.lang.IllegalStateException: Handler sending message to a Handler on a dead thread #96140

Closed
Tom3652 opened this issue Jan 4, 2022 · 13 comments
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@Tom3652
Copy link

Tom3652 commented Jan 4, 2022

Steps to Reproduce

I have no way to reproduce this issue i am sorry, but sometimes (4 times so far) i have the following error using the camera: ^0.9.4+5 package on my Android devices :

W/MessageQueue( 9684): Handler (android.os.Handler) {b3d2c3c} sending message to a Handler on a dead thread
W/MessageQueue( 9684): java.lang.IllegalStateException: Handler (android.os.Handler) {b3d2c3c} sending message to a Handler on a dead thread
W/MessageQueue( 9684): 	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:568)
W/MessageQueue( 9684): 	at android.os.Handler.enqueueMessage(Handler.java:770)
W/MessageQueue( 9684): 	at android.os.Handler.sendMessageAtTime(Handler.java:719)
W/MessageQueue( 9684): 	at android.os.Handler.sendMessageDelayed(Handler.java:689)
W/MessageQueue( 9684): 	at android.os.Handler.post(Handler.java:419)
W/MessageQueue( 9684): 	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2594)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.postDrained(TaskDrainer.java:202)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.checkIfDrainFinished(TaskDrainer.java:197)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.beginDrain(TaskDrainer.java:185)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskSingleDrainer.beginDrain(TaskSingleDrainer.java:87)
W/MessageQueue( 9684): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl$AbortDrainListener.onDrained(CameraCaptureSessionImpl.java:929)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.lambda$postDrained$0$TaskDrainer(TaskDrainer.java:207)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.-$$Lambda$TaskDrainer$Jb53sDskEXp_qIjiikQeCRx0wJs.run(Unknown Source:2)
W/MessageQueue( 9684): 	at android.os.Handler.handleCallback(Handler.java:899)
W/MessageQueue( 9684): 	at android.os.Handler.dispatchMessage(Handler.java:100)
W/MessageQueue( 9684): 	at android.os.Looper.loop(Looper.java:238)
W/MessageQueue( 9684): 	at android.os.HandlerThread.run(HandlerThread.java:67)

Here is a bit of the code that handle the lifecycle :

@override
  void dispose() {
    // Dispose the controller when the widget is disposed.
    cameraController.dispose();
    WidgetsBinding.instance!.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    if (state == AppLifecycleState.resumed) {
      cameraController.resumePreview();
    }
    if (state == AppLifecycleState.inactive) {
      cameraController.pausePreview();
    }
    super.didChangeAppLifecycleState(state);
  }

I provide a bit more logs below that show maybe better the context (camera related) of what's happening at this moment.

Note : this is not crashing the application.

Do you have any ideas about what might cause this ?

Expected results:

The logs should not show an error IllegalStateException from Java code.

Actual results:

The logs are showing a thrown IllegalStateException.

Logs
I/flutter ( 9684): camera list :[CameraDescription(0, CameraLensDirection.back, 90), CameraDescription(1, CameraLensDirection.front, 270)]
I/flutter ( 9684): camera description : CameraDescription(0, CameraLensDirection.back, 90)
I/Camera  ( 9684): close
I/Camera  ( 9684): closeCaptureSession
I/Camera  ( 9684): CameraCaptureSession onClosed
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
W/CameraManagerGlobal( 9684): ignore the torch status update of camera: 7
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
W/CameraManagerGlobal( 9684): ignore the torch status update of camera: 5
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
W/CameraManagerGlobal( 9684): ignore the torch status update of camera: 2
E/libc    ( 9684): Access denied finding property “vendor.camera.aux.packagelist”
W/CameraManagerGlobal( 9684): ignore the torch status update of camera: 6
W/MessageQueue( 9684): Handler (android.os.Handler) {b3d2c3c} sending message to a Handler on a dead thread
W/MessageQueue( 9684): java.lang.IllegalStateException: Handler (android.os.Handler) {b3d2c3c} sending message to a Handler on a dead thread
W/MessageQueue( 9684): 	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:568)
W/MessageQueue( 9684): 	at android.os.Handler.enqueueMessage(Handler.java:770)
W/MessageQueue( 9684): 	at android.os.Handler.sendMessageAtTime(Handler.java:719)
W/MessageQueue( 9684): 	at android.os.Handler.sendMessageDelayed(Handler.java:689)
W/MessageQueue( 9684): 	at android.os.Handler.post(Handler.java:419)
W/MessageQueue( 9684): 	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2594)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.postDrained(TaskDrainer.java:202)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.checkIfDrainFinished(TaskDrainer.java:197)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.beginDrain(TaskDrainer.java:185)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskSingleDrainer.beginDrain(TaskSingleDrainer.java:87)
W/MessageQueue( 9684): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl$AbortDrainListener.onDrained(CameraCaptureSessionImpl.java:929)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.TaskDrainer.lambda$postDrained$0$TaskDrainer(TaskDrainer.java:207)
W/MessageQueue( 9684): 	at android.hardware.camera2.utils.-$$Lambda$TaskDrainer$Jb53sDskEXp_qIjiikQeCRx0wJs.run(Unknown Source:2)
W/MessageQueue( 9684): 	at android.os.Handler.handleCallback(Handler.java:899)
W/MessageQueue( 9684): 	at android.os.Handler.dispatchMessage(Handler.java:100)
W/MessageQueue( 9684): 	at android.os.Looper.loop(Looper.java:238)
W/MessageQueue( 9684): 	at android.os.HandlerThread.run(HandlerThread.java:67)
I/Camera  ( 9684): open | onClosed
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale fr-FR)
    • Flutter version 2.8.1 at /Users/foxtom/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/foxtom/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2020.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 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.63.2)
    • VS Code at /Users/foxtom/Desktop/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (3 available)
    • CPH1931 (mobile) • ee9b32b5 • android-arm64  • Android 10 (API 29)
    • macOS (desktop)  • macos    • darwin-x64     • macOS 12.1 21C52 darwin-x64
    • Chrome (web)     • chrome   • web-javascript • Google Chrome 96.0.4664.110

• No issues found!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Jan 5, 2022
@darshankawar
Copy link
Member

@Tom3652
The error log looks similar to this. Can you try the replication mentioned in it and see if you still get same error as above ?
Related PR that fixed the linked issue: flutter/plugins#4319

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 5, 2022
@Tom3652
Copy link
Author

Tom3652 commented Jan 5, 2022

Yes sure i have tried the replication but it seems fixed by the PR in his case.

However, the use case is almost like mine meaning when switching "pages".
I say this because before it seems the issue was related to the Activity switch in Android and I have a Navigator.pushAndRemoveUntil() called when this occurs.

Unfortunately, even by changing a bit the sample code provided (instead of the ImagePicker i use the Navigator.pushAndRemoveUntil()) i could not reproduce it...

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 5, 2022
@darshankawar
Copy link
Member

Please check if this link helps.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 6, 2022
@Tom3652
Copy link
Author

Tom3652 commented Jan 7, 2022

It's actually the logic i had before changing to pausePreview() and resumePreview() but in my case this was causing more trouble to dispose the camera and re init it.
If this is the only solution, i will not change anything and it's not that bad since it doesn't crash the app and the camera is still working, not frozen or anything so i prefer having this error rather the ones i had with the other logic.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 7, 2022
@darshankawar
Copy link
Member

It's actually the logic i had before changing to pausePreview() and resumePreview() but in my case this was causing more trouble to dispose the camera and re init it.

Can you please elaborate on this ? Are you saying changing to pausePreview() and resumePreview() is causing the said issue ?

If this is the only solution,

Which solution are you referring to ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2022
@Tom3652
Copy link
Author

Tom3652 commented Jan 10, 2022

Can you please elaborate on this ? Are you saying changing to pausePreview() and resumePreview() is causing the said issue ?

Probably, because i was using the dispose() and re initialize() before switching to pausePreview() and resumePreview()

Which solution are you referring to ?

The solution would be to let the pausePreview() and resumePreview() despite having rarely the above error.
When i was not using this, i had crashes that i have made in other separate issues.
So i prefer having this error than the crashes i had when using dispose().

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2022
@darshankawar
Copy link
Member

Would be good if there's a pattern or repro code you can come up with using pausePreview() and resumePreview() along with dispose() and then initialize that would lead to IllegalStateException.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 11, 2022
@Tom3652
Copy link
Author

Tom3652 commented Jan 13, 2022

It actually depends on the android version, i have got ARN on some phones that have Android 11 and above.
It might be linked to #95921.

My code is this one :

@override
  void initState() {
    super.initState();
    // Allows to listen to the application lifecycle states.
    WidgetsBinding.instance!.addObserver(this);
    WidgetsBinding.instance!.addPostFrameCallback((Duration timeStamp) {
      _cameraViewModel.initCamera();
    });
  }

  @override
  void dispose() {
    _cameraViewModel.disposeCamera();
    WidgetsBinding.instance!.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    switch (state) {
      case AppLifecycleState.resumed:
        _cameraViewModel.resumeCamera();
        break;
      case AppLifecycleState.inactive:
        _cameraViewModel.pauseCamera();
        break;
      case AppLifecycleState.paused:
        break;
      case AppLifecycleState.detached:
        break;
    }
  }

And in CameraViewModel :


Future<void> initCamera() async {
    PermissionStatus status = await Permission.camera.request();
    if (status.isGranted) {
      List<CameraDescription> availableCams = await availableCameras();
      _cameras.clear();
      _cameras.addAll(availableCams);
      cameraController = CameraController(_cameras.first, ResolutionPreset.veryHigh, enableAudio: false);
      if (!cameraController!.value.isInitialized) {
        await cameraController!.initialize();
        cameraController!.setFlashMode(FlashMode.off);
      }
    } else {
      if (status.isPermanentlyDenied) {
        AppSettings.openAppSettings();
      }
    }
  }

  void disposeCamera() {
    if (cameraController != null && cameraController!.value.isInitialized) {
      cameraController!.dispose();
      cameraController = null;
    }
  }

  void resumeCamera() {
    if (cameraController != null) {
      if (cameraController!.value.isPreviewPaused) {
        cameraController!.resumePreview();
      } else {
        initCamera();
      }
    }
  }

  void pauseCamera() {
    if (cameraController != null && cameraController!.value.isInitialized) {
      cameraController!.pausePreview();
    }
  }

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 13, 2022
@darshankawar
Copy link
Member

Thanks for above code. I am trying to inculcate that into camera plugin example. Can you also try to do the same using the plugin example and see if you are able to replicate it ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 14, 2022
@Tom3652
Copy link
Author

Tom3652 commented Jan 17, 2022

Well with the example i got this error first :

I/Camera  (20320): runPrecaptureSequence
I/Camera  (20320): refreshPreviewCaptureSession
D/CameraCaptureCallback(20320): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 0 | aeState: 2
D/CameraCaptureCallback(20320): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 0 | aeState: 2
I/Camera  (20320): captureStillPicture
D/Camera  (20320): Updating builder with feature: ExposureLockFeature
D/Camera  (20320): Updating builder with feature: ExposurePointFeature
D/Camera  (20320): Updating builder with feature: ZoomLevelFeature
D/Camera  (20320): Updating builder with feature: AutoFocusFeature
D/Camera  (20320): Updating builder with feature: NoiseReductionFeature
I/Camera  (20320): updateNoiseReduction | currentSetting: fast
D/Camera  (20320): Updating builder with feature: FocusPointFeature
D/Camera  (20320): Updating builder with feature: ResolutionFeature
D/Camera  (20320): Updating builder with feature: SensorOrientationFeature
D/Camera  (20320): Updating builder with feature: FlashFeature
D/Camera  (20320): Updating builder with feature: ExposureOffsetFeature
D/Camera  (20320): Updating builder with feature: FpsRangeFeature
I/Camera  (20320): sending capture request
I/Camera  (20320): unlockAutoFocus
I/Camera  (20320): refreshPreviewCaptureSession
I/Camera  (20320): onImageAvailable
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): nav bar mode ignore false downX 649 downY 1251 mScreenHeight 1600 mScreenWidth 720 mStatusBarHeight 36 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=649.0, y[0]=1251.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1285826387, downTime=1285826387, deviceId=5, source=0x1002, displayId=0 }
D/ColorViewRootUtil(20320): swipeFromBottom!
I/chatty  (20320): uid=10566(com.testapp.android) identical 3 lines
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): nav bar mode ignore false downX 214 downY 1220 mScreenHeight 1600 mScreenWidth 720 mStatusBarHeight 36 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=214.0, y[0]=1220.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1285827557, downTime=1285827557, deviceId=5, source=0x1002, displayId=0 }
D/ColorViewRootUtil(20320): swipeFromBottom!
I/Camera  (20320): prepareMediaRecorder
E/CheckPermission(20320): media_record-code= 24
I/MediaRecorder(20320): setAudioSource() as = 1
I/MediaRecorder(20320): init()
E/CheckPermission(20320): media_record-code= 2
E/CheckPermission(20320): media_record-code= 23
E/CheckPermission(20320): media_record-code= 12
I/MediaRecorder(20320): setVideoSource() vs = 2
E/CheckPermission(20320): media_record-code= 11
I/MediaRecorder(20320): setOutputFormat() of = 2
E/CheckPermission(20320): media_record-code= 13
I/MediaRecorder(20320): setAudioEncoder() ae = 3
E/CheckPermission(20320): media_record-code= 15
E/CheckPermission(20320): media_record-code= 20
E/CheckPermission(20320): media_record-code= 20
I/MediaRecorder(20320): setVideoEncoder() ve = 2
E/CheckPermission(20320): media_record-code= 14
E/CheckPermission(20320): media_record-code= 20
E/CheckPermission(20320): media_record-code= 19
D/MediaRecorder(20320): setVideoSize(720, 480)
E/CheckPermission(20320): media_record-code= 18
E/CheckPermission(20320): media_record-code= 20
D/MediaRecorder(20320): mHypnusCtrl is true
E/CheckPermission(20320): media_record-code= 16
I/MediaRecorder(20320): prepare()
E/CheckPermission(20320): media_record-code= 9
E/CheckPermission(20320): media_record-code= 5
I/Camera  (20320): closeCaptureSession
I/Camera  (20320): CameraCaptureSession onClosed
I/Camera  (20320): CameraCaptureSession onConfigured
I/Camera  (20320): Updating builder settings
D/Camera  (20320): Updating builder with feature: ExposureLockFeature
D/Camera  (20320): Updating builder with feature: ExposurePointFeature
D/Camera  (20320): Updating builder with feature: ZoomLevelFeature
D/Camera  (20320): Updating builder with feature: AutoFocusFeature
D/Camera  (20320): Updating builder with feature: NoiseReductionFeature
I/Camera  (20320): updateNoiseReduction | currentSetting: fast
D/Camera  (20320): Updating builder with feature: FocusPointFeature
D/Camera  (20320): Updating builder with feature: ResolutionFeature
D/Camera  (20320): Updating builder with feature: SensorOrientationFeature
D/Camera  (20320): Updating builder with feature: FlashFeature
D/Camera  (20320): Updating builder with feature: ExposureOffsetFeature
D/Camera  (20320): Updating builder with feature: FpsRangeFeature
I/Camera  (20320): refreshPreviewCaptureSession
I/MediaRecorder(20320): start() enter +++
E/CheckPermission(20320): media_record-code= 8
I/MediaRecorder(20320): start() end; use totalTime = 30463 Us
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): nav bar mode ignore false downX 492 downY 1245 mScreenHeight 1600 mScreenWidth 720 mStatusBarHeight 36 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=492.0, y[0]=1245.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1285829280, downTime=1285829280, deviceId=5, source=0x1002, displayId=0 }
D/ColorViewRootUtil(20320): swipeFromBottom!
I/MediaRecorder(20320): stop()
E/CheckPermission(20320): media_record-code= 7
D/ColorViewRootUtil(20320): swipeFromBottom!
E/MediaRecorder(20320): stop failed: -1007
E/MethodChannel#plugins.flutter.io/camera(20320): Failed to handle method call
E/MethodChannel#plugins.flutter.io/camera(20320): java.lang.RuntimeException: stop failed.
E/MethodChannel#plugins.flutter.io/camera(20320): 	at android.media.MediaRecorder.stop(Native Method)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.plugins.camera.Camera.stopVideoRecording(Camera.java:726)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.plugins.camera.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:125)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at android.os.Handler.handleCallback(Handler.java:899)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at android.os.Looper.loop(Looper.java:238)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at android.app.ActivityThread.main(ActivityThread.java:7884)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512)
E/MethodChannel#plugins.flutter.io/camera(20320): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:998)
E/flutter (20320): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: CameraException(error, stop failed.)
E/flutter (20320): #0      CameraController.stopVideoRecording (package:camera/src/camera_controller.dart:531:7)
E/flutter (20320): <asynchronous suspension>
E/flutter (20320): 
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): nav bar mode ignore false downX 640 downY 1238 mScreenHeight 1600 mScreenWidth 720 mStatusBarHeight 36 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=640.0, y[0]=1238.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1285833671, downTime=1285833671, deviceId=5, source=0x1002, displayId=0 }
D/ColorViewRootUtil(20320): swipeFromBottom!
I/Camera  (20320): refreshPreviewCaptureSession
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): swipeFromBottom!
D/ColorViewRootUtil(20320): nav bar mode ignore false downX 512 downY 1219 mScreenHeight 1600 mScreenWidth 720 mStatusBarHeight 36 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=512.0, y[0]=1219.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1285834511, downTime=1285834511, deviceId=5, source=0x1002, displayId=0 }
D/ColorViewRootUtil(20320): swipeFromBottom!
E/flutter (20320): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: CameraException(INVALID_PATH, The platform "TargetPlatform.android" did not return a path while reporting success. The platform should always return a valid path or report an error.)
E/flutter (20320): #0      MethodChannelCamera.stopVideoRecording (package:camera_platform_interface/src/method_channel/method_channel_camera.dart:242:7)
E/flutter (20320): <asynchronous suspension>
E/flutter (20320): #1      CameraController.stopVideoRecording (package:camera/src/camera_controller.dart:524:20)
E/flutter (20320): <asynchronous suspension>
E/flutter (20320): 

You get the above error when tweaking around with the pause button, the start video recording and the stop video recording (all the time if you do it a bit fast).

Regarding the lifecycle i was not able to reproduce this issue using the example code yet, i had much time lately i will try better a bit later.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 17, 2022
@darshankawar
Copy link
Member

From above log, I see couple of different exceptions:

java.lang.RuntimeException: stop failed. seems similar to #79306

Unhandled Exception: CameraException(INVALID_PATH. looks similar to #86169
#96270

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 18, 2022
@github-actions
Copy link

github-actions bot commented Feb 8, 2022

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

@github-actions github-actions bot closed this as completed Feb 8, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

2 participants