Operation failed: OperationResponse 226: ReturnCode: 32758 - when trying to join a random room.

Options
Operation failed: OperationResponse 226: ReturnCode: 32758 - when trying to join a random room.

I get this error when clients joins a room at the same time as other clients leaves. This is the code that I'm calling. I don't think the room props are significant as I had this issue also before adding them.

var roomProps = new ExitGames.Client.Photon.Hashtable();
roomProps[ "type" ] = "solo";
PhotonNetwork.JoinRandomRoom( roomProps, 0, MatchmakingMode.FillRoom, null, null, null );

I can repro this by creating two clients that joins/creates a room and immediately leaves that room. I keep this "create/join - leave" cycle running for a minute or so. Eventually one of the clients will halt with this error.
Is this intended behaviour?
I would except a OnPhotonRandomJoinFailed callback on all cases where random room join fails. Now I just a get a join lobby callback.

Best, He

Stack trace:

Operation failed: OperationResponse 226: ReturnCode: 32758 (Game does not exist). Parameters: {} Server: GameServer
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1627)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

Platform:
Mac
Unity 2017.4.5f1

Comments

  • Hi @heen,

    I get this error when clients joins a room at the same time as other clients leaves.


    The problem is about the simultaneous actions of both clients. Basically the client who wants to join a random room, receives valid information about an existing room. In the meantime, the client inside this random room, leaves the room and furthermore the room gets removed from the server. The client who wants to join this room now, tries to do this with the information he has. He currently doesn't know, that this information are not valid any longer. As a result he gets this error message instead of the OnPhotonRandomJoinFailed callback.

    There is one option you have to avoid such a scenario: while creating the room, you can set the EmptyRoomTtl value to something > 0 by using the RoomOptions. The result is that the room won't get removed immediately after the last client has left it. This way you should get rid of the issue, but players might join empty rooms.

    If your game has enough players when it's live, the issue most likely won't occur at all.
  • heen
    Options
    Thanks Christian, this helps.

    Now that you say this I think I have the opposite problem in the live environment. Our rooms have max 32 players. And about 5000CCU in one region. I see that sometimes players gets disconnected at the time they are trying to connect to the room.

    Is it possible that a player checks the room status and gets 31 as answer, but when trying to join there are already 32 players in that room?

    I will continue to dig into this and post the error here when I find it.

    Best, He
  • Is it possible that a player checks the room status and gets 31 as answer, but when trying to join there are already 32 players in that room?


    I guess this might happen due to simultaneous actions, too. Do you use the void OnPhotonRandomJoinFailed(object[] codeAndMsg) in the live version and does it get called? If it gets called, you can use it in order to try to join another room. If it doesn't get called and the client gets disconnected from Photon, you can try using the void OnConnectionFail(DisconnectCause cause) callback. This one gets called, when something causes the connection to fail (after it was established). On the one hand you can take a look at the DisconnectCause in order to see what went wrong, on the other hand you can try to reconnect to Photon, if the connection got interrupted accidentally.
  • heen
    Options
    Operation failed: OperationResponse 226: ReturnCode 32764 (Game closed). Parameters: {} Server: GameServer

    I get this error when letting a couple of bots simulate real matches for an hour. This seems to be a different error than the "Game does not exist" error.

    Could this be related to the above mentioned theory of "31 before join, 32 at join"?

    Should I also add a similar path to OnConnectionFail? What would the error to check for then be?

    I will continue to debug this and see if I get a better stack trace.

    Best, He

    PS Yes, we do use the OnPhotonRandomJoinFailed and continue from there with CreateRoom.
  • "Game Closed" basically describes the IsOpen property of the Room Options. If you set this value to false, no other client can join this room and this error message is thrown. Do you set IsOpen to false anywhere in your code?

    As you already guessed, this is a different error message than "Game does not exist" and "Game Full" which you probably would expect in this case.

    Should I also add a similar path to OnConnectionFail? What would the error to check for then be?


    As described, OnConnectionFail is called, when something causes the connection to fail after it has been established, for example if the client loses his internet connection. Is the client really disconnected from Photon after failing joining a room? If so, I'm currently not sure if the DisconnectCause is very helpful in this case.

    PS Yes, we do use the OnPhotonRandomJoinFailed and continue from there with CreateRoom.


    Good to see, because this might be the best approach to handle this situation.
  • heen
    Options
    Yes, the system works so that a room is closed (by setting IsOpen = false) when either 32 players join or 30 seconds have lapsed.

    I will continue to debug why clients sometimes fails to join/create a room. I will create new post when get a trace of this.

    Best, He
  • When the room gets automatically closed (in this case: IsOpen = false) after 30 seconds, then you might have a problem with simultaneous actions again. Basically the same as two clients are trying to get the last free slot in a room.