Webhooks Error

Hi
I am testing WebHooks and using 1.2 with IsPersistent = true and AsyncJoin = true with the memory demo and all seems to work OK except when I try to join a saved room.

When I try to join a saved room, the room is recreated from the WebHooks saved state and using Type="Load" the response is all cork but the room is closed immediately with the error Requested cache slice=1 not available????:

2017-05-06 00:00:05,409 [40] DEBUG Photon.Hive.Plugin.CreateGameCallInfo - Continue.
2017-05-06 00:00:05,412 [40] DEBUG Photon.Hive.HiveGame - Processing Join from IP: 10.0.0.138 to port: 5056
2017-05-06 00:00:05,415 [40] WARN Photon.Hive.HiveGame - JoinApplyGameStateChanges: Game 'u364-845' userId '6d7ffef7-9bf1-4ac3-94af-dbce1e8187ed' failed to join. msg:Requested cache slice=1 not available. -- peer:GameClientPeer: PID 16, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 05-05-17 2:00:04 PM in Room u364-845, IP 10.0.0.138:62709,
2017-05-06 00:00:05,418 [40] DEBUG Photon.Hive.HiveGame - JoinFailureHandler is called for peer with reason:OperationInvalid.room:u364-845,p:GameClientPeer: PID 16, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 05-05-17 2:00:04 PM in Room u364-845, IP 10.0.0.138:62709,
2017-05-06 00:00:05,421 [40] DEBUG Photon.Hive.HiveHostGame - JoinFailureHandler is called for peer with reason:OperationInvalid.room:u364-845,p:GameClientPeer: PID 16, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 05-05-17 2:00:04 PM in Room u364-845, IP 10.0.0.138:62709,
2017-05-06 00:00:05,425 [40] DEBUG Photon.Hive.HiveHostGame - Peer join stage is 3. reason:3. CallPluginOnLeaveIfJoinFailed is called. p:GameClientPeer: PID 16, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 05-05-17 2:00:04 PM in Room u364-845, IP 10.0.0.138:62709,
2017-05-06 00:00:05,427 [40] DEBUG Photon.Hive.HiveGame - Actor not found for peer: 16

I am not sure why this pappens but I am now attaching the web hooks debug

2017-05-05 14:00:05,695 [20] DEBUG LogFileAppender - PostRequest: http://rpgwh.azurewebsites.net/api/GameCreate - {"ActorNr":0,"GameId":"u364-845","UserId":"6d7ffef7-9bf1-4ac3-94af-dbce1e8187ed","CreateOptions":{"LobbyId":null,"LobbyType":0,"EmptyRoomTTL":0,"PlayerTTL":0,"CheckUserOnJoin":false,"DeleteCacheOnLeave":false,"SuppressRoomEvents":false},"CreateIfNotExists":false,"Type":"Load"}
2017-05-05 14:00:06,140 [20] DEBUG LogFileAppender - PostResponse: {"ResultCode":0,"State":{"ActorCounter":1,"ActorList":[{"ActorNr":1,"UserId":"6d7ffef7-9bf1-4ac3-94af-dbce1e8187ed","Nickname":"u364","Binary":"RGIAAAEBRAAAAAFi/3MABHUzNjQ=","DeactivationTime":"2017-05-05T13:59:47.9282703+00:00","DEBUG_BINARY":{"1":{"255":"u364"}}}],"Binary":{"18":"RAAAABZzAAJ0I2kAAAABcwACMTNiCHMAAjE0YgdzAAE4YgFzAAE5YgVzAAIxNWIBYvp5AAJzAAR0dXJuAAVuYW1lc3MAAjExYgVzAAEyYgJzAAEzYgJzAAEwYgZzAAExYghzAAE2YgZzAAE3YgNzAAE0YgRzAAE1YgdzAAIxMmIDcwAFZmxpcHN4AAAAAv//cwACcHRpAAAAAHMABHB0LTFiAHMAAjEwYgRzAAVuYW1lc3MABHUzNjQ="},"CheckUserOnJoin":true,"CustomProperties":{"names":"u364"},"DeleteCacheOnLeave":true,"EmptyRoomTTL":5000,"IsOpen":true,"IsVisible":true,"LobbyType":0,"LobbyProperties":["turn","names"],"MaxPlayers":2,"PlayerTTL":2147483647,"SuppressRoomEvents":false,"Slice":0,"DebugInfo":{"DEBUG_PROPERTIES_18":{"t#":1,"13":8,"14":7,"8":1,"9":5,"15":1,"250":["turn","names"],"11":5,"2":2,"3":2,"0":6,"1":8,"6":6,"7":3,"4":4,"5":7,"12":3,"flips":"//8=","pt":0,"pt-1":0,"10":4,"names":"u364"}},"ExcludedActors":[],"PublishUserId":false,"ExpectedUsers":[]}}
2017-05-05 14:00:06,979 [16] DEBUG LogFileAppender - AppId: api - RequestUri: http://rpgwh.azurewebsites.net/api/GetGameList - Request(Serialize): {"UserId":"6d7ffef7-9bf1-4ac3-94af-dbce1e8187ed"}
2017-05-05 14:00:07,912 [16] DEBUG LogFileAppender - {"Data":{"u364-845":{"ActorNr":1,"Properties":{"names":"u364"}}},"ResultCode":0}
2017-05-05 14:00:11,785 [15] DEBUG LogFileAppender - http://rpgwh.azurewebsites.net/api/GameClose - {"ActorCount":1,"GameId":"u364-845","State":{"ActorCounter":1,"ActorList":[{"ActorNr":1,"UserId":"6d7ffef7-9bf1-4ac3-94af-dbce1e8187ed","Nickname":"u364","Binary":"RGIAAAEBRAAAAAFi/3MABHUzNjQ=","DeactivationTime":"2017-05-05T13:59:47.9282703+00:00","DEBUG_BINARY":{"1":{"255":"u364"}}}],"Binary":{"18":"RAAAABZzAAJ0I2kAAAABcwACMTNiCHMAAjE0YgdzAAE4YgFzAAE5YgVzAAIxNWIBYvp5AAJzAAR0dXJuAAVuYW1lc3MAAjExYgVzAAEyYgJzAAEzYgJzAAEwYgZzAAExYghzAAE2YgZzAAE3YgNzAAE0YgRzAAE1YgdzAAIxMmIDcwAFZmxpcHN4AAAAAv//cwACcHRpAAAAAHMABHB0LTFiAHMAAjEwYgRzAAVuYW1lc3MABHUzNjQ="},"CheckUserOnJoin":true,"CustomProperties":{"names":"u364"},"DeleteCacheOnLeave":true,"EmptyRoomTTL":5000,"IsOpen":true,"IsVisible":true,"LobbyType":0,"LobbyProperties":["turn","names"],"MaxPlayers":2,"PlayerTTL":2147483647,"SuppressRoomEvents":false,"Slice":0,"DebugInfo":{"DEBUG_PROPERTIES_18":{"t#":1,"13":8,"14":7,"8":1,"9":5,"15":1,"250":["turn","names"],"11":5,"2":2,"3":2,"0":6,"1":8,"6":6,"7":3,"4":4,"5":7,"12":3,"flips":"//8=","pt":0,"pt-1":0,"10":4,"names":"u364"}},"ExcludedActors":[],"PublishUserId":false,"ExpectedUsers":[]},"State2":null,"Type":"Save"}
2017-05-05 14:00:13,198 [15] DEBUG LogFileAppender - {"ResultCode":0}

Comments

  • Hi @petergpls,

    Thank you for choosing Photon!

    Please give us snippet of client code you use to join or rejoin room. It seems you request cache slice index 1 somehow.
    What SDK are you using?
  • petergplspetergpls
    edited May 8
    Hi
    The SDK is the for the MAC and it's Photon-Windows-Sdk_v4-1-6-0
    I am testing the demo_memory client and I have to admit there were some bugs I had to fix. The code that finally gets called by the client is as follows (is there a more stable version?).

    Also the documentation says to use opReJoinRoom but there is no example code for that. THANKS
    bool Client::opJoinRoom(const JString& gameID, int playerNumber, int cacheSliceIndex, const JVector<JString>& expectedUsers)
    		{
                
    			if(getIsInGameRoom())
    			{
    				EGLOG(DebugLevel::ERRORS, L"already in a gameroom");
    				return false;
    			}
    
    			OperationRequestParameters op = mpPeer->opJoinRoomImplementation(mRoomName=gameID, RoomOptions(), getIsOnGameServer()?getLocalPlayer().getCustomProperties():Hashtable(), false, playerNumber, getIsOnGameServer()?cacheSliceIndex:0, expectedUsers);
    			if(getLocalPlayer().getName().length())
    			{
    				if((ValueObject<Hashtable>*)op.getValue(ParameterCode::PLAYER_PROPERTIES))
    					((ValueObject<Hashtable>*)op.getValue(ParameterCode::PLAYER_PROPERTIES))->getDataAddress()->put(Properties::Player::PLAYERNAME, getLocalPlayer().getName());
    				else
    				{
    					Hashtable playerProp;
    					playerProp.put(Properties::Player::PLAYERNAME, getLocalPlayer().getName());
    					op.put(ParameterCode::PLAYER_PROPERTIES, ValueObject<Hashtable>(playerProp));
    				}
    			}
    
    			if(!gameID.length() || !opCustom(OperationRequest(OperationCode::JOIN_ROOM, op), true))
    				return false;
    
    			MutableRoom* oldRoom = mpCurrentlyJoinedRoom;
    			mpCurrentlyJoinedRoom = createMutableRoom(gameID, Hashtable(), JVector<JString>(), 0, 0, false, NULL, false, expectedUsers);
    			destroyMutableRoom(oldRoom);
    			mLastJoinPlayerNumber = playerNumber;
    			mLastCacheSliceIndex = cacheSliceIndex;
    			if(mState != PeerStates::Joining)
    				mLastJoinType = JoinType::JOIN_ROOM;
    			return true;
    		}
  • Sorry I meant the SDK is Photon-iOS-Sdk_v4-1-6-0
  • Now the debugger shows that the LoadBalancing server fails in the below code on the line marked with ---->

    protected bool JoinApplyGameStateChanges(HivePeer peer, JoinGameRequest joinRequest, SendParameters sendParameters, out Actor actor)
    {
    var isCreatingGame = false;
    var isNewGame = false;
    if (peer.JoinStage == HivePeer.JoinStages.CreatingOrLoadingGame)
    {
    isCreatingGame = true;
    if (this.CheckBeforeJoinThisIsNewCreatedRoom(joinRequest))
    {
    isNewGame = true;
    this.ApplyGameProperties(joinRequest);
    }
    else
    {
    this.CopyGamePropertiesForMasterUpdate(joinRequest);
    }
    }

    actor = null;
    peer.JoinStage = HivePeer.JoinStages.ConvertingParams;
    if (this.IsDisposed)
    {
    // join arrived after being disposed - repeat join operation
    if (Log.IsWarnEnabled)
    {
    Log.WarnFormat("Join operation on disposed game. GameName={0}", this.Name);
    }

    return false;
    }

    if (!this.ConvertParamsAndValidateGame(peer, joinRequest, sendParameters))
    {
    return false;
    }

    peer.JoinStage = HivePeer.JoinStages.CheckingCacheSlice;
    ----> if (joinRequest.CacheSlice.HasValue && !this.EventCache.HasSlice(joinRequest.CacheSlice.Value))
    {
    var msg = string.Format(HiveErrorMessages.CacheSliceNoAviable, joinRequest.CacheSlice);
    this.SendErrorResponse(peer, joinRequest.OperationCode, ErrorCode.OperationInvalid, msg, sendParameters);
    joinRequest.OnJoinFailed(ErrorCode.OperationInvalid, msg);

    if (Log.IsWarnEnabled)
    {
    Log.WarnFormat("JoinApplyGameStateChanges: Game '{0}' userId '{1}' failed to join. msg:{2} -- peer:{3}",
    this.Name, peer.UserId, msg, peer);
    }
    return false;
    }

    [deleted........]
    }
  • Its now OK - it was a bug in the demo client code where the actorNbr was passed as the cacheslice - thanks for pointing me in the right direction. I guess I had thought that the demo/examples were tested very time a new enhancement came along but I guess this perhaps is not the case.
  • I'm glad you managed to solve this.
    I apologize about the inconvenience.
    We will try to fix this issue in the demo and we are working on making the documentation more generic and less dependent on the C# SDKs with more snippets.
  • Hi @petergpls.

    Thanks for pointing us to this.
    I can confirm that this is a bug in the code of demo_memory in the current release.
    We will fix this for 4.1.7.0
Sign In or Register to comment.