mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Example android app for holistictrackinggpu crashes due to null pointer dereference

Open elbakramer opened this issue 3 years ago • 3 comments

Please make sure that this is a bug and also refer to the troubleshooting, FAQ documentation before raising any issues.

System information (Please provide as much relevant information as possible)

  • Have I written custom code (as opposed to using a stock example script provided in MediaPipe): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): Built on Ubuntu 20.04 LTS on WSL2 on Windows 11 Pro, Run on Android 12
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: Samsung Galaxy Note10+
  • Browser and version (e.g. Google Chrome, Safari) if the issue happens on browser: N/A
  • Programming Language and version (e.g. C++, Python, Java): C++ and Java, related tools are installed via sudo apt-get install -y build-essential openjdk-8-jdk
  • MediaPipe version: Latest master branch, https://github.com/google/mediapipe/commit/63e679d99ca45b30514a9d84c9351a2d77bb9ba0
  • Bazel version (if compiling from source): 5.2.0
  • Solution (e.g. FaceMesh, Pose, Holistic): Holistic
  • Android Studio, NDK, SDK versions (if issue is related to building in Android environment): NDK version r21, Used bundled installation script
  • Xcode & Tulsi version (if issue is related to building for iOS): N/A

Describe the current behavior:

Example android app for holistictrackinggpu crashes due to null pointer dereference

Describe the expected behavior:

Example android app for holistictrackinggpu runs normally

Standalone code to reproduce the issue: Provide a reproducible test case that is the bare minimum necessary to replicate the problem. If possible, please share a link to Colab/repo link /any notebook:

Steps to reproduce:

  1. do git clone https://github.com/google/mediapipe.git and cd mediapipe
  2. run setup_android_sdk_and_ndk.sh script in order to install android sdk/ndk
  3. build an apk with bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/holistictrackinggpu:holistictrackinggpu
  4. install the built apk to a mobile device with adb install bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/holistictrackinggpu/holistictrackinggpu.apk
  5. start installed app in mobile device, with the app name of "Holistic Tracking"
  6. then app crashes after few seconds

Tried the same process with other apps like basic:helloworld or handtrackinggpu:handtrackinggpu but those cases worked fine.

Other info / Complete 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

> adb logcat --clear
> adb logcat *:F
--------- beginning of crash
07-31 16:46:52.355 24179 24220 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 in tid 24220 (mediapipe_gl_ru), pid 24179 (stictrackinggpu)
07-31 16:46:52.718 24305 24305 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-31 16:46:52.718 24305 24305 F DEBUG   : Build fingerprint: 'samsung/d2xks/d2x:12/SP1A.210812.016/N976NKSU2HVE9:user/release-keys'
07-31 16:46:52.718 24305 24305 F DEBUG   : Revision: '24'
07-31 16:46:52.718 24305 24305 F DEBUG   : ABI: 'arm64'
07-31 16:46:52.718 24305 24305 F DEBUG   : Processor: '6'
07-31 16:46:52.718 24305 24305 F DEBUG   : Timestamp: 2022-07-31 16:46:52.418560317+0900
07-31 16:46:52.718 24305 24305 F DEBUG   : Process uptime: 2s
07-31 16:46:52.718 24305 24305 F DEBUG   : Cmdline: com.google.mediapipe.apps.holistictrackinggpu
07-31 16:46:52.718 24305 24305 F DEBUG   : pid: 24179, tid: 24220, name: mediapipe_gl_ru  >>> com.google.mediapipe.apps.holistictrackinggpu <<<
07-31 16:46:52.718 24305 24305 F DEBUG   : uid: 10601
07-31 16:46:52.718 24305 24305 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
07-31 16:46:52.718 24305 24305 F DEBUG   : Cause: null pointer dereference
07-31 16:46:52.718 24305 24305 F DEBUG   :     x0  0000000000000000  x1  0000000000000070  x2  fffffffffffffffa  x3  0000007d23d43418
07-31 16:46:52.718 24305 24305 F DEBUG   :     x4  7265666675625f6d  x5  6d5f627566666572  x6  7265666675625f6d  x7  0000ddec0000de50
07-31 16:46:52.718 24305 24305 F DEBUG   :     x8  0000000000000000  x9  0000007e23d6e1b0  x10 0000000000000003  x11 0000007e53d86110
07-31 16:46:52.718 24305 24305 F DEBUG   :     x12 0000007e53d86218  x13 6060606060606060  x14 00000000000000b6  x15 8080803480808060
07-31 16:46:52.718 24305 24305 F DEBUG   :     x16 0000007bea9630f8  x17 0000007bea341f00  x18 0000007bdf5cc000  x19 0000007d23d434f0
07-31 16:46:52.718 24305 24305 F DEBUG   :     x20 0000000000000040  x21 0000000000000000  x22 0000000000000002  x23 0000007d23d43418
07-31 16:46:52.718 24305 24305 F DEBUG   :     x24 0000007bed32cdd0  x25 0000007d23d43410  x26 0000000000000000  x27 0000000000000000
07-31 16:46:52.718 24305 24305 F DEBUG   :     x28 0000000000000004  x29 0000007bed32cbf0
07-31 16:46:52.718 24305 24305 F DEBUG   :     lr  0000007bea157b74  sp  0000007bed32ca40  pc  0000007bea157ba0  pst 0000000020000000
07-31 16:46:52.718 24305 24305 F DEBUG   : backtrace:
07-31 16:46:52.718 24305 24305 F DEBUG   :       #00 pc 00000000008e7ba0  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::cl::InferenceContext::AllocateBufferBasedTensors(tflite::gpu::GpuModel const&, tflite::gpu::GpuInfo const&, tflite::gpu::CreateGpuModelInfo const*, tflite::gpu::cl::CLContext*)+2852)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #01 pc 00000000008e48f0  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::cl::InferenceContext::AllocateMemory(tflite::gpu::GpuModel const&, tflite::gpu::GpuInfo const&, tflite::gpu::CreateGpuModelInfo const*, tflite::gpu::cl::CLContext*)+148)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #02 pc 00000000008e3e54  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::cl::InferenceContext::InitFromGpuModel(tflite::gpu::CreateGpuModelInfo const&, tflite::gpu::GpuModel*, tflite::gpu::cl::Environment*, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> >*, tflite::gpu::cl::Buffer*)+184)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #03 pc 00000000008e3d48  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::cl::InferenceContext::InitFromGraph(tflite::gpu::CreateGpuModelInfo const&, tflite::gpu::GraphFloat32 const&, tflite::gpu::cl::Environment*, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> >*)+176)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #04 pc 00000000008dbcd8  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::cl::(anonymous namespace)::InferenceEnvironmentImpl::NewInferenceBuilder(tflite::gpu::cl::InferenceOptions const&, tflite::gpu::GraphFloat32, std::__ndk1::unique_ptr<tflite::gpu::InferenceBuilder, std::__ndk1::default_delete<tflite::gpu::InferenceBuilder> >*)+900)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #05 pc 00000000008d9218  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::TFLiteGPURunner::InitializeOpenCL(std::__ndk1::unique_ptr<tflite::gpu::InferenceBuilder, std::__ndk1::default_delete<tflite::gpu::InferenceBuilder> >*)+764)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #06 pc 00000000008d88c8  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (tflite::gpu::TFLiteGPURunner::Build()+348)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #07 pc 0000000000666248  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::api2::InferenceCalculatorGlAdvancedImpl::InitTFLiteGPURunner(mediapipe::CalculatorContext*)+2280)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #08 pc 0000000000b9e494  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (std::__ndk1::__function::__func<mediapipe::GlContext::Run(std::__ndk1::function<absl::lts_20210324::Status ()>, int, mediapipe::Timestamp)::$_8, std::__ndk1::allocator<mediapipe::GlContext::Run(std::__ndk1::function<absl::lts_20210324::Status ()>, int, mediapipe::Timestamp)::$_8>, absl::lts_20210324::Status ()>::operator()()+48)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #09 pc 0000000000b99af4  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlContext::DedicatedThread::Run(std::__ndk1::function<absl::lts_20210324::Status ()>)+92)
07-31 16:46:52.718 24305 24305 F DEBUG   :       #10 pc 0000000000b9a9b8  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlContext::Run(std::__ndk1::function<absl::lts_20210324::Status ()>, int, mediapipe::Timestamp)+752)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #11 pc 0000000000b3e008  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlCalculatorHelperImpl::RunInGlContext(std::__ndk1::function<absl::lts_20210324::Status ()>, mediapipe::CalculatorContext*)+208)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #12 pc 0000000000b3c984  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlCalculatorHelper::RunInGlContext(std::__ndk1::function<absl::lts_20210324::Status ()>)+208)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #13 pc 000000000066456c  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::api2::InferenceCalculatorGlAdvancedImpl::Open(mediapipe::CalculatorContext*)+1012)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #14 pc 0000000000b83208  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::CalculatorNode::OpenNode()+840)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #15 pc 0000000000b6a738  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::internal::SchedulerQueue::OpenCalculatorNode(mediapipe::CalculatorNode*)+276)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #16 pc 0000000000b6a4d4  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::internal::SchedulerQueue::RunNextTask()+220)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #17 pc 0000000000b9e948  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (std::__ndk1::__function::__func<mediapipe::GlContext::RunWithoutWaiting(std::__ndk1::function<void ()>)::$_9, std::__ndk1::allocator<mediapipe::GlContext::RunWithoutWaiting(std::__ndk1::function<void ()>)::$_9>, void ()>::operator()()+52)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #18 pc 0000000000b999dc  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlContext::DedicatedThread::ThreadBody()+276)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #19 pc 0000000000b99360  /data/app/~~_3UMcti9z2gfvAubPw4ZUg==/com.google.mediapipe.apps.holistictrackinggpu-Gt-PgrcvvDkLlqnU9EUHDw==/lib/arm64/libmediapipe_jni.so (mediapipe::GlContext::DedicatedThread::ThreadBody(void*)+8)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #20 pc 00000000000b4ad8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: eb0c8b7f827292af83855e89b431276a)
07-31 16:46:52.719 24305 24305 F DEBUG   :       #21 pc 0000000000052c08  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: eb0c8b7f827292af83855e89b431276a)

If I search for the pid number printed above, I can also find a line of error log like below, But I have no idea whether this might be helpful or not:

07-31 16:46:50.896 24179 24179 E libEGL  : validate_display:547 error 3008 (EGL_BAD_DISPLAY)

elbakramer avatar Jul 31 '22 07:07 elbakramer

Hi @elbakramer , Did you use the Android gradle solution or Android AAR ? We have similar issue which has solution , please refer this closed issue.

sureshdagooglecom avatar Aug 02 '22 15:08 sureshdagooglecom

I think it's neither gradle nor aar.

I'm not using gradle but using bazel with android_binary rule to build an app. Also what I know about aar is that we need to use mediapipe_aar bazel rule for building an aar but I'm not using any of that.

Similarly the issue you've mentioned is talkiing about Android Solutions API but again I'm just building an app directly using bazel's android_binary rule, not using the solutions api.

I reckon that Android Solutions API related examples are under solutions directory https://github.com/google/mediapipe/tree/master/mediapipe/examples/android/solutions

But I'm using examples under apps directory, which do not use solutions api https://github.com/google/mediapipe/tree/master/mediapipe/examples/android/src/java/com/google/mediapipe/apps and specifically the holistictrackinggpu app caused the crash among few apps that I've tested https://github.com/google/mediapipe/tree/master/mediapipe/examples/android/src/java/com/google/mediapipe/apps/holistictrackinggpu

elbakramer avatar Aug 03 '22 10:08 elbakramer

I will try to follow your instructions on a Ubuntu to gLinux workstation, and see if the holistictrackinggpu app fails there as well. If this problem occurs only under windows or windows 11 ubuntu, I may need some help to reproduce it and investigate it.

hadon avatar Sep 07 '22 09:09 hadon

hi,you can check if the assets (.tflite ...) which used in the graph are in you project and have the same file name.

zhouhengda avatar Mar 02 '23 09:03 zhouhengda

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Mar 14 '23 05:03 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Mar 21 '23 06:03 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Mar 21 '23 06:03 google-ml-butler[bot]