-
Notifications
You must be signed in to change notification settings - Fork 74k
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
segfault in FlexDelegate on android #38025
Comments
The first thing to check is that you're using the latest nightly builds. Can you try manually clearing your gradle cache or change
to
? |
Ok, I've tried switching to the "changing=true" syntax and rerunning, and after that I tried clearing the gradle cache (by removing ~/.gradle/caches) and I reran again. In both cases, the segfault was still there. |
I see, thanks for checking. It's possible this is an emulator-specific issue. We'll take a look. |
Ok, thanks! If there are any other checks I can do that would be helpful, I'm happy to give them a shot; just let me know. |
If you can attach the logcat preceding the seg fault, that might be useful. |
Ok, the logcat from the last run I did follows. 2020-03-31 14:31:28.646 18654-18654/? I/tflitebugrepor: Not late-enabling -Xcheck:jni (already on) |
That looks potentially suspicious, though it doesn't immediately address the seg fault. It's very helpful though, we'll try to get back to you soon. |
Thanks! I agree that the "SSE instructions" message does look suspicious. One more observation, in case it helps: I notice that if I change the FlexDelegate to an NnApiDelegate, then I don't see a segfault, and I don't get the 'SSE instructions' message either. |
I can reproduce the problem in my side as well. Will take a look for finding a root cause. |
FYI, you can disable using SSE instructions by providing --copt="-mno-sse4" to the bazel build command. |
I met the same problem:
After build tensorflow without sse4.1 and sse4.2, it works! |
Is there any possibility this issue could be solved natively in tensorflow-lite? I'm also experiencing it when running an Android emulator. |
Internal build script is updated. |
Looks like this works on my setup -- many thanks to all who helped! |
This also worked for me. If you're not familiar with gradle like myself, because the dependency version numbers are the same for every nightly build, you need to refresh your dependencies to get the latest nightly release. Click Gradle (right-hand side of Android Studio), then Execute Gradle Task (the elephant icon), and enter |
Has this issue returned for anyone else? I've done the above process to re-download dependencies, but my app has started crashing with the same segfault errors again. build.gradle:
Crash:
|
@terryheo could you take a look at #38025 (comment) ? |
I can verified the issue. Let me dig and prepare a fix. |
Avoid using std::cerr. This patch resolves GitHub issue #38025. PiperOrigin-RevId: 346452855 Change-Id: Ife2504476b265909814c09c900cbb5090a55fcc5
The change was merged a week ago. But using nightly is still crashing since there is an issue of updating JCenter. |
Hi There, We are checking to see if you still need help on this issue, as you are using an older version of tensorflow(1.x) which is officially considered as end of life. We recommend that you upgrade to 2.4 or later version and let us know if the issue still persists in newer versions. This issue will be closed automatically 7 days from now. If you still need help with this issue, Please open a new issue for any help you need against 2.x, and we will get you the right help. |
I'm hoping to run a custom tensorflow/tflite model (one that uses tflite's select ops) on-device in an android app. My understanding is that I need to configure the tflite interpreter with a FlexDelegate, but when I try to do this (on the android-studio emulator), the app segfaults, apparently in the FlexDelegate constructor. I've managed to reproduce the crash in a minimal code, which I link to and describe below.
Thanks in advance for any help on this, and thanks also to all the devs for creating tensorflow!
System information
example script provided in TensorFlow): Only a little. I've added a call to the FlexDelegate constructor in the MainActivity of the default flutter app that android studio generates when you tell it to start a new project.
the issue happens on mobile device: the android emulator that android-studio provides (I've tested a few configurations including api 27, 29, and R as well as x86 and x86_64 abis)
in app/build.gradle,
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly'
Describe the current behavior
the app crashes while attempting to construct a FlexDelegate instance while running in the emulator. (I actually don't have a physical device handy, so I can't test to see if it happens on real hardware right now.)
Describe the expected behavior
FlexDelegate should be created with no segfault
Standalone code to reproduce the issue
The line that crashes is
FlexDelegate delegate = new FlexDelegate();
which I've added to the configureFlutterEngine method of the app's MainActivity. I've put the code for the full example app in this repository:
https://github.com/particlebbq/tflite_bug_report
Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.
The error message in the logcat is:
2020-03-29 16:22:01.392 11042-11042/com.example.tflitebugreport A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4 in tid 11042 (tflitebugreport), pid 11042 (tflitebugreport)
The text was updated successfully, but these errors were encountered: