Azure / azure-spatial-anchors-samples

Azure Spatial Anchors sample code
Other
293 stars 138 forks source link

CreateSessionAsync hangs indefinitely on Android but works on iOS #383

Open LexDeKogel opened 1 year ago

LexDeKogel commented 1 year ago

Description

I was asked to create a new issue but it's close to the same as this https://github.com/Azure/azure-spatial-anchors-samples/issues/230

I have tried the sample app and everything seems to work as it should, when I tried to add Azure Anchors to the project we are working on however I ran into the issue that CreateSessionAsync hangs indefinitely without giving any kind of error.

I have a method that looks like this:

Debug.Log("START TRY CATCH"); try { await azureAnchorManager.CreateSessionAsync(); } catch (Exception e) { Debug.LogError(e); throw; } Debug.Log("Finish try catch");

When running this method on Android I get the "START TRY CATCH" log, but then it ends, not the "Finish try catch" and no errors either, so it just hangs without saying anything. On iOS it does complete.

From what I understand from the other thread I linked above this could be a gradle issue, I have set everything up for gradle the same way as on the example project. I cannot tell if it is being overwritten somewhere or if there is some other issue.

Steps to reproduce the issue

See above, try to run CreateSessionAsync()

Expected behavior

CreateSessionAsync() creates the session, completes at some point and/or gives an error telling me what's wrong.

Screenshots None

Development information (please complete the following information)

AR Device information (please complete the following information):

Additional context

None

Varnauld commented 1 year ago

Assigning to @darax (tracking n#42358280)

LexDeKogel commented 1 year ago

Hey @darax do you think you could help out? Still stuck on this.

darax commented 1 year ago

@LexDeKogel Can you try setting the ASA Logging to full (SpatialAnchorManager.SessionLogLevel = SesionLogLevel.All/see below) and check logcat from android? Unity has a package for Android logcat, or you can use android studio.

image

LexDeKogel commented 1 year ago

@darax Thanks for the reply, I already had the Log Level set to All like in your screenshot and was testing with logcat, normally I test with:

.\adb logcat -s Unity

So that I only get the debug messages from Unity, which gives me the logs I described in my original post. Not filtering for Unity gives way too many messages to sift through, but I did it anyway and I found the messages I got right after the START TRY CATCH log, here follows a wall of text of the results. I find this quite hard to read and there are a lot of irrelevant messages in there as well if you don't filter, so I don't know if any of this is relevant. Can you tell if there is any relevant info in there and otherwise, is there anything else I should filter for than Unity that could give more useful results?

12-06 17:40:41.661 2587 2748 I Unity : START TRY CATCH 12-06 17:40:41.661 2587 2748 I Unity : Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat(LogType, Object, String, Object[]) 12-06 17:40:41.661 2587 2748 I Unity : Wintor.Compose.Core.AR.d__12:MoveNext() 12-06 17:40:41.661 2587 2748 I Unity : System.Action:Invoke() 12-06 17:40:41.661 2587 2748 I Unity : System.Action1:Invoke(T) 12-06 17:40:41.661 2587 2748 I Unity : Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1:TrySetResult(TResult) 12-06 17:40:41.661 2587 2748 I Unity : Cysharp.Threading.Tasks.DelayFramePromise:MoveNext() 12-06 17:40:41.661 2587 2748 I Unity : Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:RunCore() 12-06 17:40:41.661 2587 2748 I Unity : UnityEngine.LowLevel.UpdateFunction:Invoke() 12-06 17:40:41.661 2587 2748 I Unity : 12-06 17:40:41.664 984 1183 W OMXNodeInstance: getConfig(0xec804760:Exynos.avc.dec, ??(0x7f030009)) (0x8000101a) 12-06 17:40:41.664 2587 5814 W ACodec : [OMX.Exynos.avc.dec] getting HDRStaticInfo failed even though codec advertises support 12-06 17:40:41.667 2587 5813 I MediaCodec: setCodecState state(1), called in 6 12-06 17:40:41.668 4091 4091 I SemMediaResourceHelper: onState 12-06 17:40:41.668 21600 21634 V ResourceManagerHelper-JNI: JNIMediaResourceHelper::notify eventType : 3, ext1 : 0, ext2 : 0 12-06 17:40:41.668 21600 21634 V ResourceManagerHelper-JNI: notify eventType : 3, ext1 : 0, ext2 : 0 12-06 17:40:41.669 1214 1228 V ResourceManagerHelper-JNI: JNIMediaResourceHelper::notify eventType : 3, ext1 : 0, ext2 : 0 12-06 17:40:41.669 1214 1228 V ResourceManagerHelper-JNI: notify eventType : 3, ext1 : 0, ext2 : 0 12-06 17:40:41.669 21600 21771 I SemMediaResourceHelper: onState 12-06 17:40:41.669 1214 1401 I SemMediaResourceHelper: onState 12-06 17:40:41.669 21600 21771 I DrmMediaResourceHelper: onStateChanged size = 1 12-06 17:40:41.669 21600 21771 I DrmMediaResourceHelper: resource type: 2,,,isSecured : falseIsEncoder : falsegetCodecState : 1getpid : 2587 12-06 17:40:41.673 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now Executing->Idle 12-06 17:40:41.673 984 5816 I EXYNOS_BASE_COMP: [0xec5cc820][Exynos_OMX_ComponentStateSet] current:(OMX_StateExecuting) dest:(OMX_StateIdle) 12-06 17:40:41.674 984 5821 W libexynosv4l2: failed to ioctl: VIDIOC_DQBUF (22 - Invalid argument) 12-06 17:40:41.678 984 5816 I EXYNOS_BASE_COMP: [0xec5cc820][Exynos_OMX_ComponentStateSet] OMX_EventCmdComplete(OMX_StateIdle) 12-06 17:40:41.681 984 5816 I EXYNOS_BASE_COMP: [0xec5cc820][Exynos_OMX_ComponentStateSet] current:(OMX_StateIdle) dest:(OMX_StateLoaded) 12-06 17:40:41.683 984 5821 W libexynosv4l2: failed to ioctl: VIDIOC_DQBUF (22 - Invalid argument) 12-06 17:40:41.699 984 5816 I EXYNOS_BASE_COMP: [0xec5cc820][Exynos_OMX_EventHandler] OMX_EventCmdComplete(OMX_StateLoaded) 12-06 17:40:41.700 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now Idle->Loaded 12-06 17:40:41.701 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now Loaded 12-06 17:40:41.701 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now kWhatShutdownCompleted event : 7985 12-06 17:40:41.702 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now kWhatShutdownCompleted event : 7985 12-06 17:40:41.706 2587 5814 I ACodec : [OMX.Exynos.avc.dec] Now uninitialized 12-06 17:40:41.706 2587 5814 I ACodec : [] Now kWhatShutdownCompleted event : 7985 12-06 17:40:41.707 2587 5813 I MediaCodec: Codec shutdown complete 12-06 17:40:41.708 973 23374 I ResourceManagerService: removeResourceInfo pid 2587, removed 2764800 (width 1920 height 1440), isLowPriority 0, remained hw codec count 0 12-06 17:40:41.708 1214 1228 V ResourceManagerHelper-JNI: JNIMediaResourceHelper::notify eventType : 2, ext1 : 0, ext2 : 0 12-06 17:40:41.708 1214 1228 V ResourceManagerHelper-JNI: notify eventType : 2, ext1 : 0, ext2 : 0 12-06 17:40:41.708 1214 1401 I SemMediaResourceHelper: onRemove 12-06 17:40:41.708 21600 21634 V ResourceManagerHelper-JNI: JNIMediaResourceHelper::notify eventType : 2, ext1 : 0, ext2 : 0 12-06 17:40:41.709 21600 21634 V ResourceManagerHelper-JNI: notify eventType : 2, ext1 : 0, ext2 : 0 12-06 17:40:41.709 4091 4091 I SemMediaResourceHelper: onRemove 12-06 17:40:41.709 21600 21771 I SemMediaResourceHelper: onRemove 12-06 17:40:41.718 2587 2843 D MediaCodecList: codecHandlesFormat: no format, so no extra checks 12-06 17:40:41.719 2587 2843 D MediaCodecList: codecHandlesFormat: no format, so no extra checks 12-06 17:40:41.720 2587 2843 I ACodec : [] Now uninitialized 12-06 17:40:41.721 2587 5836 I ACodec : [] onAllocateComponent 12-06 17:40:41.722 2587 5836 I OMXClient: IOmx service obtained 12-06 17:40:41.723 984 30195 I OMXMaster: makeComponentInstance(OMX.Exynos.avc.dec) in android.hardwar process 12-06 17:40:41.725 1214 1500 D SemCellularStateManager: onCellInfoChanged: cellInfoList Number of cell: 13 12-06 17:40:41.725 1214 1500 D SemCellularStateManager: onCellInfoChanged: Registered = true, mCellularCellId = 2514189 12-06 17:40:41.732 984 30195 D libexynosv4l2: try node: /dev/video6 12-06 17:40:41.732 984 30195 I libexynosv4l2: node found for device s5p-mfc-dec: /dev/video6 12-06 17:40:41.738 955 14184 E camera_metadata: validate_camera_metadata_structure: metadata is null! 12-06 17:40:41.738 955 14184 E Camera2-Metadata: acquire: Failed to validate metadata structure 0x0 12-06 17:40:41.738 955 14184 E camera_metadata: validate_camera_metadata_structure: metadata is null! 12-06 17:40:41.738 955 14184 E Camera2-Metadata: acquire: Failed to validate metadata structure 0x0 12-06 17:40:41.738 955 14184 E camera_metadata: validate_camera_metadata_structure: metadata is null! 12-06 17:40:41.738 955 14184 E Camera2-Metadata: acquire: Failed to validate metadata structure 0x0 12-06 17:40:41.738 955 14184 E Camera2-FrameProcessorBase: removeListener: 12-06 17:40:41.740 955 1580 D Camera3-Device: CameraPerf: constructDefaultRequestSettings templateId: 3 E 12-06 17:40:41.740 777 1212 I ExynosCameraInterface: INFO(HAL3_camera_device_construct_default_request_settings[548]):in ===== 12-06 17:40:41.740 777 1212 I ExynosCameraMetadataConverter: [CAM(0)][]-(constructDefaultRequestSettings[104]):Type(3) 12-06 17:40:41.740 777 1212 I ExynosCameraMetadataConverter: [CAM(0)][]-(constructDefaultRequestSettings[141]):type is CAMERA3_TEMPLATE_VIDEO_RECORD 12-06 17:40:41.740 777 1212 I ExynosCameraMetadataConverter: [CAM(0)][]-(constructDefaultRequestSettings[487]):Registered default request template(3) 12-06 17:40:41.740 777 1212 I ExynosCamera: [CAM(0)][Back_0]-(construct_default_request_settings[1531]):out 12-06 17:40:41.740 777 1212 I ExynosCameraInterface: INFO(HAL3_camera_device_construct_default_request_settings[557]):out ===== 12-06 17:40:41.740 777 1212 I ExynosCameraInterface: DEBUG:duration time( 0 msec):(HAL3_camera_device_construct_default_request_settings)

darax commented 1 year ago

@LexDeKogel while the app is running, logcat should give you an option to see just the output from your running app. Here's what it looks like with the unity logcat plugin. The android studio layout is similar. I'm not sure what the command line would be. image

LexDeKogel commented 1 year ago

@darax Hey late reply, sorry had some stuff come in between. But I got a bunch more logs doing it through Android Studios 👍 I found this was the first error I get after the START TRY CATCH log:

2022-12-21 10:27:35.633 26731-26767/com.Wintor.AR.dev D/CBindingAutoGen: exception causing failure: LogException @ D:/a/_work/1/s/SpatialServices/API/src/Android/AzureSpatialAnchorsApiNdk/Platform/ARCoreNdkPlatformSession.cpp:27, SpatialServices::ARCoreNdkPlatformSession::ARCoreNdkPlatformSession(ssc_platform_session_handle) : Assertion failed: m_platformSessionHandle != nullptr CallStack: ReposeStackWalker is not supported on this platform :-( 2022-12-21 10:27:35.775 26731-26767/com.Wintor.AR.dev E/Unity: InvalidOperationException: LogException @ D:/a/_work/1/s/SpatialServices/API/src/Android/AzureSpatialAnchorsApiNdk/Platform/ARCoreNdkPlatformSession.cpp:27, SpatialServices::ARCoreNdkPlatformSession::ARCoreNdkPlatformSession(ssc_platform_session_handle) : Assertion failed: m_platformSessionHandle != nullptr CallStack: ReposeStackWalker is not supported on this platform :-(. at Microsoft.Azure.SpatialAnchors.NativeLibraryHelpers.CheckStatus (System.IntPtr handle, Microsoft.Azure.SpatialAnchors.status value) [0x00000] in <00000000000000000000000000000000>:0 at Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession.Start () [0x00000] in <00000000000000000000000000000000>:0 at Microsoft.Azure.SpatialAnchors.Unity.SpatialAnchorManager+d__52.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at Microsoft.Azure.Sp

I'm on Samsung Galaxy S20+ which is pretty new, are azure anchors just not supported?