A MultiplayerService.Instance.MatchmakeSessionAsync(MatchmakerOptions, SessionOptions) async call can infinitely hang if a request timeout happens.
In my code, I’m calling MultiplayerService.Instance.MatchmakeSessionAsync inside of a try-catch block and I’m not getting any exceptions, just an infinite hang.
The faulty execution will terminate with this log.
It seems the issue starts at:
com.unity.services.multiplayer/Runtime/Multiplayer/Matchmaking/Matchmaker.cs:128
this line invokes SetState as follows:
SetState(MatchmakerState.JoinFailed)
yet SetState is defined as:
internal void SetState(MatchmakerState state)
{
State = state;
if (State is MatchmakerState.Canceled or MatchmakerState.None)
{
m_SessionCompletionSource?.TrySetCanceled();
}
StateChanged?.Invoke(State);
}
SetState will not cancel the m_SessionCompletionSource completion source when passed a MatchmakerState.JoinFailed.
Also, why is there a null access check on m_SessionCompletionSource ? it’s never supposed to be null anyway.