question

tobias-nerg avatar image
tobias-nerg asked

Crash during Lobby State change (IL2CPP build) MultiPlayerSDK Unity

Frequently running into this one in Host Migration testing. I have only seen this crash in an IL2CPP build yet. The crash only occurs on the client that has been chosen to become the new owner of the lobby (Lobby running Automatic host owner transfership).

========== OUTPUTTING STACK TRACE ==================


0x00007FFDEC03B5AD (GameAssembly) [D:\Unity\scrt\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\PlayFabMultiplayerSDK.cpp:24995] PFLobbyStateChange_CreateFromPtr_mEECCBC51571B9F6A02DE9096CE2D39C4CC93631A 
0x00007FFDEC04149B (GameAssembly) [D:\Unity\scrt\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\PlayFabMultiplayerSDK.cpp:29290] PFMultiplayer_PFMultiplayerStartProcessingLobbyStateChanges_mC53D6BDA44DC6093DA3E8DE0E19C32CF8C644F37 
0x00007FFDEC04451D (GameAssembly) [D:\Unity\scrt\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\PlayFabMultiplayerSDK.cpp:35027] PlayFabMultiplayer_ProcessLobbyStateChanges_m17DEDD8F720B6E8028BEE3ADA68B543890DF6CDF 
0x00007FFDEC0493F5 (GameAssembly) [D:\Unity\scrt\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\PlayFabMultiplayerSDK.cpp:36829] PlayfabMultiplayerEventProcessor_Update_m864EE6EA462019E982BE0A521B7463ACAE2A133B 
0x00007FFDEB9244AC (GameAssembly) [D:\Unity\scrt\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\Il2CppInvokerTable.cpp:174899] RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5 
0x00007FFDEB8A1C10 (GameAssembly) [C:\Program Files\Unity\Hub\Editor\2020.3.21f1\Editor\Data\il2cpp\libil2cpp\vm\Runtime.cpp:568] il2cpp::vm::Runtime::Invoke 
0x00007FFDEF30BD28 (UnityPlayer) UnityMain
0x00007FFDEF31F7F2 (UnityPlayer) UnityMain
0x00007FFDEF329D83 (UnityPlayer) UnityMain
0x00007FFDEF329E66 (UnityPlayer) UnityMain
0x00007FFDEF08B720 (UnityPlayer) UnityMain
0x00007FFDEF1C02FA (UnityPlayer) UnityMain
0x00007FFDEF1C03A0 (UnityPlayer) UnityMain
0x00007FFDEF1C40F8 (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFDEEF8639A)
0x00007FFDEEF8639A (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFDEEF8485B)
0x00007FFDEEF8485B (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFDEEF899F2)
0x00007FFDEEF899F2 (UnityPlayer) (function-name not available)
0x00007FFDEEF8A96B (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF6020011F2)
0x00007FF6020011F2 (Secret Game) (function-name not available)
0x00007FFEAC027034 (KERNEL32) BaseThreadInitThunk
0x00007FFEAD702651 (ntdll) RtlUserThreadStart


========== END OF STACKTRACE ===========

Lobby Creation And Lobby Update methods

public async UniTask<ErrorCode> CreateAndJoinLobby(string roomName)
{
	if (!m_loginService.LoggedIn)
	{
		Debug.LogError("You need to login to PlayFab to use Lobby services");
				return ErrorCode.GeneralError;
	}


	var createConfig = new LobbyCreateConfiguration()
	{
		MaxMemberCount = 8,
		OwnerMigrationPolicy = LobbyOwnerMigrationPolicy.Automatic,
		AccessPolicy = LobbyAccessPolicy.Public
	};


	createConfig.SearchProperties["string_key1"] = roomName;


	var joinConfig = new LobbyJoinConfiguration();


	PlayFabMultiplayer.CreateAndJoinLobby(
		GetEntityKey(),
		createConfig,
		joinConfig);


	try
	{
		await UniTask.WaitUntil(() => m_joinedLobby != null).Timeout(TimeSpan.FromSeconds(s_timeoutInSeconds));
	}
	catch (OperationCanceledException)
	{
		Debug.LogError("Tried to create and join a new lobby but didn't get a confirmation in time.");
		return ErrorCode.GeneralError;
	}


	Debug.Log("Created and joined a new lobby successfully!");
	return ErrorCode.Ok;
}
PFEntityKey m_lastOwner;


private void PlayFabMultiplayer_OnLobbyUpdated(Lobby lobby, bool ownerUpdated, bool maxMembersUpdated, bool accessPolicyUpdated, bool membershipLockUpdated, IList<string> updatedSearchPropertyKeys, IList<string> updatedLobbyPropertyKeys, IList<LobbyMemberUpdateSummary> memberUpdates)
	{
		if (ownerUpdated)
			if (lobby.TryGetOwner(out PFEntityKey owner))
			{
				if (m_lastLobbyOwner == null)
				{
					m_lastLobbyOwner = owner;
					return;
				}


				if (owner.Id.Equals(m_loginService.UserAuthenticationContext.EntityId))
				{
					Debug.Log("Lobbysystem told US to become the new host!");
					
					// Irrelevant, game internal event system.
					EventManager.TriggerEvent(EventType_Action.LocalHostMigrationStarted);
					EventManager.TriggerEvent(EventType_Action.LocalHostMigrationInProgress);

					lobby.ForceRemoveMember(m_lastLobbyOwner, false);
				}


				m_lastLobbyOwner = owner;
			}
			else
			{
				Debug.LogError("Lobby Owner was updated, however the owner could not be identified");
			}
		}
	}

I tried commending out

lobby.ForceRemoveMember(m_lastLobbyOwner, false);

and that did MOSTLY get rid of the problem.

* Reproduced using 2 players only 100% of the time.

* If the new host is a Unity editor, crash does NOT occur, only in a standalone IL2CPP build


Also 1 question:

private void PlayFabMultiplayer_OnLobbyUpdated(Lobby lobby

How long is Lobby lobby valid? My current strategy is caching it to m_joinedLobby and use that cached variable until the lobby is left, or the game is closed. Or do I need to reset m_joinedLobby in all callback functions that provide a Lobby lobby ?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image Gosen Gao commented ·

I will do some research.

0 Likes 0 ·
tobias-nerg avatar image tobias-nerg Gosen Gao commented ·

I can only provide some more information: I'm pretty sure this is all related to lobby.ForceRemoveMember being executed in a number of different states. I've commented out all the calls to it and have had no crashes for 2 days now.

Also refer to https://community.playfab.com/questions/61223/multiplayer-sdk-crash-on-unity-application-exit.html

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao tobias-nerg commented ·

We can reproduce the issue, but we need further troubleshooting to locate the cause of this issue.

1 Like 1 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.