google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 402 forks source link

SIGSEGV Crash on ARM64 when using Frame.CameraMetadata.TryGetValues #683

Open kyleleetMT opened 4 years ago

kyleleetMT commented 4 years ago

SPECIFIC ISSUE ENCOUNTERED

When using Frame.CameraMetadata.TryGetValues(CameraMetadataTag.SyncFrameNumber, new List<CameraMetadataValue>()) it will cause a SegFault crash when building with ARM64. When building with ARMv7 it operates fine.

It seems the pointer recieved from ExternApi.ACameraMetadata_getConstEntry in CameraMetadatApi.TryGetValues() is invalid on ARM64. It works on ARMv7 implying it is a 32-bit/64-bit pointer issue.

Look at CustomArCoreBackgroundRenderer.cs for our usage example.

Here is the full crash message.

2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 52da4ea800000000
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: Build fingerprint: 'OnePlus/OnePlus3/OnePlus3T:9/PKQ1.181203.001/1911042108:user/release-keys'
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: Revision: '0'
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH: pid: 10756, tid: 10817, name: UnityMain  >>> com.ModestTree.NativeAr <<<
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH:     x0   0000007e6db3d130  x1   52da4ea800000000  x2   0000000000000008  x3   0000007e52da4ea0
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH:     x4   0000007f0de55240  x5   0000000000000008  x6   0000007e52da4ea8  x7   b57a5acc4a2ae128
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH:     x8   0000000000000014  x9   0000007e6b9fb200  x10  0000007e6b9fb208  x11  0000007e6db3d130
2020-01-15 16:30:07.122 10756-10817/com.ModestTree.NativeAr E/CRASH:     x12  0000000000000000  x13  0000000000000008  x14  0000000000000001  x15  0000000000000001
2020-01-15 16:30:07.123 10756-10817/com.ModestTree.NativeAr E/CRASH:     x16  0000007e6d6730f0  x17  0000007f0df254b8  x18  00000000000004e0  x19  52da4ea800000000
2020-01-15 16:30:07.124 10756-10817/com.ModestTree.NativeAr E/CRASH:     x20  0000007e6ddf0c00  x21  0000007e6db3d120  x22  000000000000000a  x23  0000007e6db42440
2020-01-15 16:30:07.124 10756-10817/com.ModestTree.NativeAr E/CRASH:     x24  0000000000000001  x25  0000000000000003  x26  0000007e6d22857c  x27  0000007e6d6eab38
2020-01-15 16:30:07.124 10756-10817/com.ModestTree.NativeAr E/CRASH:     x28  0000000000000003  x29  0000007e6fd8f0d0  x30  0000007e6c5f8fe8
2020-01-15 16:30:07.124 10756-10817/com.ModestTree.NativeAr E/CRASH:     sp   0000007e6fd8f0b0  pc   0000007f0df25704  pstate 0000000080000000
2020-01-15 16:30:07.124 10756-10817/com.ModestTree.NativeAr E/CRASH: backtrace:

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Open SegFaultDemo Scene
  2. Build included project for ARM64 only.
  3. Run on device.
  4. Observe crash.

WORKAROUNDS (IF ANY)

Other than not using Frame.CameraMetadata.TryGetValues(CameraMetadataTag.SyncFrameNumber, there is no known workaround.

ADDITIONAL COMMENTS

Project - https://drive.google.com/open?id=1Y7vHunuSZFcyW5MQ0XwuOfIsMLe6LoCT

stephen-systemfriend commented 4 years ago

I can confirm this still happens with ARCore v1.7 Given that 64 bit builds are becoming compulsory, will we get a fix for this?

kyleleetMT commented 4 years ago

It has been half a year, can we get an update for this? As stated above, with 64 bit builds being compulsory, having basic functionality like getting camera meta data that doesn't error on 64 bit is kinda important.