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

安卓多线程调用TNN动态库崩溃问题 #1974

Open
darinshaw312 opened this issue Dec 8, 2023 · 1 comment
Open

安卓多线程调用TNN动态库崩溃问题 #1974

darinshaw312 opened this issue Dec 8, 2023 · 1 comment

Comments

@darinshaw312
Copy link

1. 环境(environment)

  • Build OS and Version: Mac
  • RunTime OS Version: Android
  • RunTime DEVICE: ARM

2. Github版本

  • branch:main
  • commit(optional):

3. 编译方式(compile method)
CMake完整编译参数(full cmake arguments)

编译参数:
ASM_FLAGS = -isystem /home/Android/android-ndk-r18b/sysroot/usr/include/aarch64-linux-android -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O2 -DNDEBUG -fPIC

ASM_DEFINES = -DTNN_ARM82=1 -DTNN_EXPORTS -D_SOURCE_DIR_LEN=39

ASM_INCLUDES = -I/home/git/gfl_algorithm/third_party/TNN/scripts/build64/third_party/gflags/include -I/home/git/gfl_algorithm/third_party/TNN/include -I/home/git/gfl_algorithm/third_party/TNN/source -I/home/git/gfl_algorithm/third_party/TNN/third_party/opencl/include -I/home/git/gfl_algorithm/third_party/TNN/source/device/opencl

CXX_FLAGS = -isystem /home/Android/android-ndk-r18b/sysroot/usr/include/aarch64-linux-android -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -Wno-pass-failed -Wno-deprecated-declarations -Wno-ignored-attributes -Wnull-dereference -DTNN_COREML_FULL_PRECISION=1 -DTNN_METAL_FULL_PRECISION=1 -fopenmp=libomp -pthread -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG -fPIC -std=gnu++11

CXX_DEFINES = -DTNN_ARM82=1 -DTNN_EXPORTS -D_SOURCE_DIR_LEN=39

CXX_INCLUDES = -I/home/git/gfl_algorithm/third_party/TNN/scripts/build64/third_party/gflags/include -I/home/git/gfl_algorithm/third_party/TNN/include -I/home/git/gfl_algorithm/third_party/TNN/source -I/home/git/gfl_algorithm/third_party/TNN/third_party/opencl/include -I/home/git/gfl_algorithm/third_party/TNN/source/device/opencl -isystem /home/Android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include -isystem /home/Android/android-ndk-r18b/sources/cxx-stl/llvm-libc++abi/include

链接参数:
/home/Android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android22 --gcc-toolchain=/home/Android/android-ndk-r18b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/home/Android/android-ndk-r18b/sysroot -fPIC -isystem /home/Android/android-ndk-r18b/sysroot/usr/include/aarch64-linux-android -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -Wno-pass-failed -Wno-deprecated-declarations -Wno-ignored-attributes -Wnull-dereference -DTNN_COREML_FULL_PRECISION=1 -DTNN_METAL_FULL_PRECISION=1 -fopenmp=libomp -pthread -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /home/Android/android-ndk-r18b/platforms/android-22/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/home/Android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -s -Wl,--gc-sections -shared -Wl,-soname,libTNN.so -o libTNN.so @CMakeFiles/TNN.dir/objects1.rsp -Wl,-Bstatic -lomp -lc++_static -lc++abi -lomp -Wl,-Bdynamic -llog -fopenmp -Wl,-Bstatic -lc++_static -lc++abi -Wl,-Bdynamic -llog -latomic -lm "/home/Android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a" "/home/Android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a"

4. 编译日志(build log)

将日志粘贴在这里
Paste log here or pastebin

./scripts/build_android.sh

5. 详细描述bug 情况 (Describe the bug)

  1. 多线程调用,release会发生崩溃,debug不会
  2. 单线程调用,无论release还是debug,均不会崩溃
  3. android平台会崩溃,测试了android-ndk18-22版本

6. 运行日志(runtime log)

2023/12/04 19:33:06.393 8740 8931 Error CRASH *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023/12/04 19:33:06.393 8740 8931 Error CRASH Version '2022.3.8f1c1 (4ec8ee1b2212)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
2023/12/04 19:33:06.393 8740 8931 Error CRASH Build fingerprint: 'samsung/r9qzc/r9q:12/SP1A.210812.016/G9900ZCU2CVI1:user/release-keys'
2023/12/04 19:33:06.393 8740 8931 Error CRASH Revision: '10'
2023/12/04 19:33:06.393 8740 8931 Error CRASH ABI: 'arm64'
2023/12/04 19:33:06.393 8740 8931 Error CRASH Timestamp: 2023-12-04 19:33:06.393202647+0800
2023/12/04 19:33:06.393 8740 8931 Error CRASH pid: 8740, tid: 8931, name: UnityMain  >>> com.GFL.EdgeBox <<<
2023/12/04 19:33:06.393 8740 8931 Error CRASH uid: 10461
2023/12/04 19:33:06.393 8740 8931 Error CRASH signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr --------
2023/12/04 19:33:06.393 8740 8931 Error CRASH Cause: null pointer dereference
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x0  000000748fed2150  x1  0000007469f78100  x2  0000000000000000  x3  ffffffffb85b83a8
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x4  0000000000000000  x5  0000000000000000  x6  fffffffffb86f238  x7  0000000000000000
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x8  ffffffffb86f2380  x9  fffffffb85b83a80  x10 0000000000000000  x11 000000004d15d8c0
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x12 fffffffffb86f238  x13 ffffffffb85b83a8  x14 0000007469f78100  x15 0000007440035fc0
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x16 00000073fb8fc3a8  x17 000000783a32b894  x18 00000073f4daa000  x19 fffffffffb86f238
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x20 0000000000000000  x21 0000000000000000  x22 0000000000000000  x23 00000073f58edfe8
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x24 00000073f58edff0  x25 0000007469f78100  x26 fffffffffb86f238  x27 0000000000000000
2023/12/04 19:33:06.393 8740 8931 Error CRASH     x28 0000000000000020  x29 00000073f58eda10
2023/12/04 19:33:06.393 8740 8931 Error CRASH     lr  00000073fb7325e4  sp  00000073f58ed940  pc  00000073fb749824  pst 0000000000001000
2023/12/04 19:33:06.393 8740 8931 Error CRASH backtrace:
2023/12/04 19:33:06.393 8740 8931 Error CRASH       #00 pc 00000000004de824  /data/app/~~RTHJqk681MC3dh0bczr08A==/com.GFL.EdgeBox--WBLOd2GF6Hwv1qoiQKL6w==/lib/arm64/[libTNN.so](http://libtnn.so/) (BuildId: d72bde5c692caa842e1490e7db9923cc3e39a6b8)

7. 截图(Screenshots)

将截图粘贴在这里
![20231208-152522](https://github.com/Tencent/TNN/assets/35446834/6a59b01c-a6ce-4461-bae5-c1d0fa90548c)
@darinshaw312
Copy link
Author

20231208-152522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant