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

Exception in C++ third party library cause crashes #1480

Closed
AlienSarlak opened this issue Mar 30, 2021 · 1 comment
Closed

Exception in C++ third party library cause crashes #1480

AlienSarlak opened this issue Mar 30, 2021 · 1 comment
Labels

Comments

@AlienSarlak
Copy link

I am currently working on porting some third party libraries that are written in C/C++ into Android. When I run my application on Android that use third party libraries I face signal 11 (SIGSEGV) and the application crashes. After investigating the libraries' code I found out that an Exception is the main reason for such behaviour. The library is PROJ 8.0 which is recognised in the GIS area. In one function the library throws an exception which is handled by the invoker function but it causes a crash and when I comment it out and replace it by return instead everything works finely. An interesting fact is that on an emulator which obviously is x86 I cannot see such behaviour and everything works fine.
My target device is armeabi-v7a, the library I am using is PROJ 8.0, the android OS is 7.0~7.1 and the NDK is r21e.

I appreciate any help.

Best,

log:
03-30 11:21:08.467: A/libc(23054): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xfffffff4 in tid 23069 (qtMainLoopThrea)
03-30 11:21:08.467: A/libc(23054): [ 03-30 11:21:08.467 401: 401 W/ ]
03-30 11:21:08.467: A/libc(23054): debuggerd: handling request: pid=23054 uid=10212 gid=10212 tid=23069
03-30 11:21:08.474: I/art(23079): Starting a blocking GC AddRemoveAppImageSpace
03-30 11:21:08.537: A/DEBUG(23096): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-30 11:21:08.537: A/DEBUG(23096): Build fingerprint: 'asus/WW_P008/P008_1:7.0/NRD90M/WW_P008-V5.7.3-20180110:user/release-keys'
03-30 11:21:08.537: A/DEBUG(23096): Revision: '0'
03-30 11:21:08.537: A/DEBUG(23096): ABI: 'arm'
03-30 11:21:08.537: A/DEBUG(23096): pid: 23054, tid: 23069, name: qtMainLoopThrea >>> org.qtproject.example <<<
03-30 11:21:08.537: A/DEBUG(23096): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4
03-30 11:21:08.537: A/DEBUG(23096): r0 fffffff4 r1 ffffffff r2 e640ed14 r3 d125feeb
03-30 11:21:08.537: A/DEBUG(23096): r4 e640ed14 r5 ced0c548 r6 00000000 r7 e640ecd0
03-30 11:21:08.537: A/DEBUG(23096): r8 e640f4c4 r9 e640f4d0 sl e640f4e0 fp e6411998
03-30 11:21:08.537: A/DEBUG(23096): ip efc81fd4 sp e640eca8 lr d105618b pc d10561cc cpsr 800f0030
03-30 11:21:08.541: A/DEBUG(23096): backtrace:
03-30 11:21:08.541: A/DEBUG(23096): #00 pc 0005d1cc /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.541: A/DEBUG(23096): #1 pc 0005d187 /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.542: A/DEBUG(23096): #2 pc 0005d161 /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.542: A/DEBUG(23096): #3 pc 0013fbb3 /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.542: A/DEBUG(23096): #4 pc 002676fd /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.542: A/DEBUG(23096): #5 pc 001b638b /data/app/org.qtproject.example-2/lib/arm/libproj.so (_ZNK5osgeo4proj2io21IPROJStringExportable18exportToPROJStringEPNS1_19PROJStringFormatterE+166)
03-30 11:21:08.542: A/DEBUG(23096): #6 pc 0021a627 /data/app/org.qtproject.example-2/lib/arm/libproj.so
03-30 11:21:08.542: A/DEBUG(23096): #7 pc 002254ff /data/app/org.qtproject.example-2/lib/arm/libproj.so (proj_create_conversion+218)
03-30 11:21:08.542: A/DEBUG(23096): #8 pc 005fb333 /data/app/org.qtproject.example-2/lib/arm/libgdal.so (_ZN19OGRSpatialReference9SetProjCSEPKc+274)
03-30 11:21:08.542: A/DEBUG(23096): #9 pc 008a1a6b /data/app/org.qtproject.example-2/lib/arm/libgdal.so (GTIFGetOGISDefnAsOSR+1714)
03-30 11:21:08.542: A/DEBUG(23096): #10 pc 00844a89 /data/app/org.qtproject.example-2/lib/arm/libgdal.so (_ZN12GTiffDataset17LookForProjectionEv+192)
03-30 11:21:08.542: A/DEBUG(23096): #11 pc 00840347 /data/app/org.qtproject.example-2/lib/arm/libgdal.so (_ZN12GTiffDataset32LoadGeoreferencingAndPamIfNeededEv+1018)
03-30 11:21:08.542: A/DEBUG(23096): #12 pc 0085e347 /data/app/org.qtproject.example-2/lib/arm/libgdal.so (_ZN12GTiffDataset15GetGeoTransformEPd+14)
03-30 11:21:08.542: A/DEBUG(23096): #13 pc 00003100 /data/app/org.qtproject.example-2/lib/arm/libAndroidTest_armeabi-v7a.so (_Z12printGeoInfo7QString+1640)
03-30 11:21:08.542: A/DEBUG(23096): #14 pc 00003614 /data/app/org.qtproject.example-2/lib/arm/libAndroidTest_armeabi-v7a.so (main+368)
03-30 11:21:08.542: A/DEBUG(23096): #15 pc 0001f3b5 /data/app/org.qtproject.example-2/lib/arm/libplugins_platforms_qtforandroid_armeabi-v7a.so

@AlienSarlak AlienSarlak changed the title [BUG] Exception in C++ third party library cause crashes Mar 30, 2021
@DanAlbert
Copy link
Member

One of your libraries is probably built incorrectly: https://android.googlesource.com/platform/ndk/+/ndk-release-r22/docs/BuildSystemMaintainers.md#Unwinding

There's not enough information here for us to investigate any more. We need a repro case, but I suspect that your library is just built wrong. Search through the other bugs filed here that include the phrase "exception" and you'll find explanations of the various issues, but if you just want a fix follow that doc for any custom build systems. If you have third-party prebuilt libraries that you cannot modify that are causing the problem you cannot really fix the problem unless you use ndk-build.

Also note that simply building all your code with r23 (not released yet) will fix this problem.

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

No branches or pull requests

2 participants