[SOLVED] Game crashes when calling JoinSession with Oculus Online Subsystem

SOLUTION ADDED 10/10/2021

This is crazy but the reason this was happening is that I was missing a file Config/Android/AndroidEngine.ini with the following contents:

[OnlineSubsystem]
DefaultPlatformService=Oculus

Without this file the game appears to fall back on the Null Online Subsystem when joining the session and it crashes the application. This was insanely frustrating to debug. Hopefully this helps someone else in the future.

Original Post

I’ve been unable to get my game working with the Oculus Online Subsystem. I can host a session one of my headsets. I can find the session on my second headset but when I call JoinSession the game crashes. Details below.

I completed my data use checkup form and have been approved for User Id, User Profile, Friends, Invites, and Matchmaking.  I’ve configured a matchmaking pool:

I have the following online subsystem plugins enabled in my project: Online Subsystem, Online Subsystem Null, Online Subsystem Oculus, Online Subsystem Utils.

I have an event on my GameInstance which creates a multiplayer session and opens my main level as a listen server:

There is another event on my GameInstance that can be called to join the first multiplayer session it finds:

When Headset A calls CreateMultiplayerMatch  it seems to successfully create a multiplayer session in my “Rated” matchmaking pool.  I can see “matchmaking enqueue room” and “matchmaking enqueue user” entries in the MatchMaking debugger within the Developer Dashboard.

When Headset B calls JoinAnyMultiplayerSession the application is able to successfully find the session created by Headset A (I can see the oculus username, ping, # players, etc) but when it calls the JoinSession node the application on Headset B (client) crashes with this stacktrace:

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdddddddd99999987 in tid 26349 (GameThread), pid 26301 (on.Redacted)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'oculus/hollywood/hollywood:10/QQ3A.200805.001/18371800151900000:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2021-09-20 22:09:13-0400
pid: 26301, tid: 26349, name: GameThread >>> com.redacted.Redacted <<<
uid: 10708
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdddddddd99999987
x0 0000007c88bab220 x1 dddddddddddddddd x2 ffffffffbbbbbbba x3 dddddddd99999997
x4 0000007c44766dda x5 000000000000000a x6 00410056004e0049 x7 000000440049004c
x8 7fffffffdddde000 x9 000000007fffffff x10 0000000000000000 x11 000000000000003e
x12 0000007c87f37b00 x13 000000000000001e x14 0000000000000000 x15 0000000000000032
x16 0000007cc25d5588 x17 0000007db227e0c0 x18 00000000000009bc x19 dddddddddddddddd
x20 ffffffffdddddddd x21 0000007d20573060 x22 0000007cc8548020 x23 0000007d20573030
x24 0000007d20bf1ec0 x25 0000007cc8548020 x26 0000007cc8541c40 x27 0000000000000000
x28 0000500000000000 x29 0000007cc85417b0
sp 0000007cc8541780 lr 0000007cbbdac860 pc 0000007db227e0e0

backtrace:
#00 pc 000000000007e0e0 /apex/com.android.runtime/lib64/bionic/libc.so (memcpy+32) (BuildId: a6e0ca3a9989715134d1d1e2126e0f7a)
#01 pc 00000000091e56b0 /data/app/com.redacted.Redacted-c7HxzmlY5sNeNxNHvQ83Ew==/lib/arm64/libUE4.so!libUE4.so (offset 0x81fa000) (FOnlineSessionNull::JoinSession(int, FName, FOnlineSessionSearchResult const&)+484) (BuildId: d0ce462983f959eb6d3ac237d4c2a08985da6379)
#02 pc 00000000088d575c /data/app/com.redacted.Redacted-c7HxzmlY5sNeNxNHvQ83Ew==/lib/arm64/libUE4.so!libUE4.so (offset 0x81fa000) (UJoinSessionCallbackProxy::Activate()+292) (BuildId: d0ce462983f959eb6d3ac237d4c2a08985da6379)
#03 pc 000000000004debc <anonymous:7c89c40000>

I’ve determined the specific line that is failing is OnlineSessionInterface.cpp:702 where the call to SearchSessionInfo->HostAddr->Clone() is made:

I’m not sure if it’s related (seems likely) but leaderboards also don’t work for me. My call to “Write Leaderboard Integer” reports success but I never see any scores posted to my leaderboard when I look in the Developer Dashboard.

Is it expected for FOnlineSubsystemNull to be used when I have the Oculus Online Subsystem enabled? Some sort of optimization since both of my headsets are on my LAN? Seems wrong to me but other oculus platform features are working, like creating a multiplayer session or finding available sessions. Totally confusing and frustrating.

I am desperate to find a solution to get leaderboards and matchmaking working with the Oculus Online Subsystem. If anyone has an idea of what it could be, or something to try, please let me know!  I’ve run out of ideas.

Here is my [link DefaultEngine.ini][5] configuration.