[JNI crashes] Properly throw Java Exceptions from VideoCaptureDeviceFactoryAndroid::GetSupportedFormats |
|||||||
Issue descriptionVideoCaptureDeviceFactoryAndroid::GetSupportedFormats doesn't seem to call back into the embedding app - so fixing this case would "only" help us fix our Java-crashes (rather than helping embedding-app developers). VideoCaptureDeviceFactoryAndroid::GetSupportedFormats calls into Java with the following calls Java_VideoCaptureFactory_getDeviceSupportedFormats Java_VideoCaptureFactory_getCaptureFormatPixelFormat Java_VideoCaptureFactory_getCaptureFormatWidth Java_VideoCaptureFactory_getCaptureFormatHeight Java_VideoCaptureFactory_getCaptureFormatFramerate Crash.corp URL: https://crash.corp.google.com/browse?q=custom_data.ChromeCrashProto.magic_signature_1.name%20CONTAINS%20%27%5BAndroid%20Java%20Exception%5D%27%20AND%20product.name%3D%27AndroidWebView%27%20AND%20NOT%20product.Version%20CONTAINS%20%2754.0.2%27%20AND%20NOT%20product.Version%20CONTAINS%20%2753.0.2%27%20AND%20NOT%20product.Version%20CONTAINS%20%2752.0.2%27%20AND%20NOT%20product.Version%20CONTAINS%20%2751.0.2%27%20AND%20special_protos.user_feedback.mobile_data.crash_data.exception_class_name%3D%27Native%20crash%27%20AND%20custom_data.ChromeCrashProto.magic_signature_1.name%3D%27%5BAndroid%20Java%20Exception%5D%20media%3A%3AVideoCaptureDeviceFactoryAndroid%3A%3AGetSupportedFormats%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D
,
May 5 2017
This is probably just a case where we need to catch a bunch of exceptions and ignore the issue because the framework is broken, rather than propagating them.
,
May 5 2017
Yeah, do we have a good way of finding the Java exception stack traces though?
,
May 5 2017
,
May 5 2017
For the cases where particular framework methods are backed by complex often-vendor-specific code (and media codecs seem especially likely here) I suspect that chromium just needs to unfortunately move toward catching Exception and hoping for the best, at which point the stack isn't that important.
,
May 9 2017
,
May 9 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
May 14 2018
Adding OWNERS. qinmin@, mcasas@ would you be opposed to catching all exceptions from the framework in VideoCaptureCamera(2).java? I see crashes in clank, so I'm removing the webview component.
,
May 18 2018
,
Jul 23
VideoCaptureDeviceFactoryAndroid::GetSupportedFormats goes through a lot of chromium Java code before it calls into framework stuff. So we should probably be careful about what we catch. And we can't know what to catch without seeing the Java stacks, since we can't predict OEM badness a priori. So I think the first step here would be to expose these as Java crashes, then sift through the crashes we get and decide which to ignore.
,
Jul 24
If it's reasonably easy to get this to actually be an uncaught java exception then that's fine, but I was assuming that this was going to be difficult (as most of them are), and if so I'm not sure it's worth it. If we're going to try to guard from bad OEM changes then we should be putting the try-catch handling around the specific places where we call framework APIs that might explode (so that we can try our best to handle the failure rationally), *not* here at the top level where we call from C++ into Java anyway.
,
Jul 24
Right, but there's a lot of different APIs being called in VideoCaptureCamera{,2}.java, and I don't think we can know ahead of time which ones might explode.
Or we could catch for every API, which would be ugly, but easier to implement.
,
Jul 24
Yes, what I'm proposing is that for every call we make to the framework in this known-to-be-dodgy area, if it is both: 1) plausibly going to throw an undocumented exception maybe and 2) possible to do something other than crash, e.g. assume "not supported" or "give up" in some noncrashy way then we should wrap it in a generic try-catch block that handles a wide range of possible exceptions. :(
,
Jul 25
Looking into the various APIs, many of them call back into native after very little Java code. Would you expect OEM native badness to manifest by throwing Java exceptions through the API? I would think they would just crash in native.
,
Jul 25
Well clearly something is throwing java exceptions, and the normal expectation with JNI code *is* that the native code throws java exceptions instead of crashing in native, especially for errors that map reasonably to java exceptions (e.g. bad parameters and the like, not "we randomly dereferenced a bad pointer" which would indeed just segfault). If there's a reasonably straightforward way for us to actually get the java exception stacks here then go ahead, but this doesn't seem worth doing any radical restructuring of the calling code for. |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by boliu@chromium.org
, May 5 2017