-
Notifications
You must be signed in to change notification settings - Fork 408
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
Crash in Fotoapparat.start(): IOException: setPreviewTexture failed #178
Comments
Correct me if wrong. So ways to reproduce are instantly call: |
Yes, just quickly calling start() then stop() should reproduce it. The crash occurs before onDestroy() so you can ignore that. |
Calling fotoapparat.start(), fotoapparat.stop() one after each other cannot reproduce it (since they run in a single thread).
Maybe surface becomes/was never unavailable onStop() 🤔 |
I have the same bug here :
this problem happens when I hit back button in any second activity to return to cameraactivity. |
thanks for the reproduction steps @Kim24 |
I cannot reproduce it. Can you please provide some more info, code with replicating example etc...? Things I tried, both work fine (on pixel 2):
|
I think this issue only occurs on certain devices. I found it after only a few tests on the Samsung Galaxy Grand Prime but it never occurred in 100+ tests on a Samsung Galaxy S8. |
I can also reproduce this error with the following code
When pausing/resuming the app really fast a couple of times on a Galaxy S6 running Android 6.0.1 I get the following crash:
. |
Since |
Thanks for the fix! It no longer crashes but I'm seeing that this can leave the device in a state where the camera preview is black and no frames are passed to the frame processor. Do you think this should be propagated to the cameraErrorCallback instead of ignoring it?
|
@jpribble Agree with you. All off exceptions if the lib cannot handle should be propagated to error callback instead of ignore and close the issue. I also got this after open any camera app then get back to my app. @dmitry-zaitsev Pls consider to return known exceptions in the error callback, and let us handle by our self, at least we can call recreate screen or show a error message. |
What are you trying to achieve or the steps to reproduce?
This crash was observed on a Samsung Galaxy Grand Prime running Android 5.1.1. It occurred when the camera activity was destroyed immediately after being resumed. Here is the scenario:
During step 3 above, CameraActivity's onStart() (calls camera.start()), onStop() (call camera.stop()), and onDestroy() are all called in less than 1 second.
What was the result you received?
Fatal crash due to an uncaught IOException: setPreviewTexture failed in Fotoapparat's startRoutine.
Logs:
What did you expect?
If there is an exception inside Fotoapparat's async routines, it should be caught and, if it's fatal, be sent to the cameraErrorCallback.
I could work around this by optimizing the code not to call camera.start() when it's about to be destroyed but I still wanted to report this uncaught exception since it may affect others.
Context:
The text was updated successfully, but these errors were encountered: