Why Master Client dont be switched in inactive state?

Options
When master client disconnect and his state changed to inactive, photon will not switch master client to another active player. in the duration between start of inactiving and rejoining, the room has not any active master client, so many conditions in the code not satisfied. :( WHY? is this a bug?

Best Answers

Answers

  • jeanfabre
    Options
    Hi,

    How do you know MasterClient is not reassigned?

    Are you implementing the callback OnMasterClientSwitched ?
    http://doc-api.exitgames.com/en/pun/current/class_photon_1_1_pun_behaviour.html#a53833ef0f9be9906694fc600acc1b897

    Do you get some activity on that callback when you disconnect the masterClient?

    Bye,

    Jean
  • ahoogol
    Options
    Hi @jeanfabre
    jeanfabre said:


    How do you know MasterClient is not reassigned?

    I check PhotonNetwork.masterClient or player1.IsMasterClient.
    jeanfabre said:


    Are you implementing the callback OnMasterClientSwitched ?

    Yes. it not called
    I found three UseCase that are not expected:
    UC1: 1.MasterClient close connection and go to inactive state(inactive=true). 2. then master client stay on him and not reasssigned.
    UC2: after UC1 => 3. the inactive master client dont return back to game after playerTtl (60 Seconds) and it is removed from playerlist of the room. 4.the room now has not any master client because master client not reassigned. PhotonNetwork.masterClient return null for other players in the room.
    UC3: after UC1 => 3.the inactive master client return back to game by calling PhotonNetwork.reconnectAndReJoin() and go to active state(inactive=false). 4. the master client now leave room. 5. the room now has not any master client because master client not reassigned. PhotonNetwork.masterClient return null for other players in the room.
    :( Help plz. are there a BUG !?
  • ahoogol
    ahoogol
    edited June 2016
    Options
    New Thing Found: when i call PhotonNetwork.SetMasterClient(nextMasterClient) in during current master client is inactive, it fail and get error response:
    Operation failed: OperationResponse 252: ReturnCode: -2 (CAS update failed: property='248' has value='2'). Parameters: {} Server: GameServer
    in debuging i found master client is switched to new one in the server but clients didnt know. because expected properties for GamePropertyKey.MasterClientId when calling PhotonNetwork.SetMasterClient is different.

    I used photon server OnPremise SDK and PUN (Last version). Help plz :(
  • jeanfabre
    Options
    Hi,

    ok, thanks for your information. It's very useful. I think the problem is that a player can be inactive for a moment and this is conflicting with logics when that client is the master client.

    we are currently investigating on how to resolve this. I'll keep you up dated on the fix.

    Right now, If you are in a rush, I would account for that potential error in your code, or reduce the time to live of players to limit the possibilities of this to happen.

    Bye,

    Jean

  • jeanfabre
    Options
    Hi,

    Quick question: You are setting Player Time to Live right? how much is this value?

    Bye,

    Jean
  • ahoogol
    ahoogol
    edited June 2016
    Options
    Thanks @jeanfabre
    I am happy from your news and i am waiting for next release :)
    jeanfabre said:

    Quick question: You are setting Player Time to Live right? how much is this value?

    Yes, this value is PlayerTtl = 60000 (1min, Maximum value i think)

  • ahoogol
    ahoogol
    edited July 2016
    Options
    jeanfabre said:

    ok, we found the issue, a fix has been made, so it will be available in the next release very very soon.

    Hi @jeanfabre ,
    Pun v1.73 was released a few days ago. but this issue has not been fixed yet. :(

  • jeanfabre
    Options
    Hi,

    uhm, thanks for reporting, I'll investigate further, I'll get back to you on this.

    Bye,

    Jean
  • jeanfabre
    Options
    Hi,

    ok, yes, that's odd. I'll get back to you when we have another fix :)

    Bye,

    Jean
  • ahoogol
    Options
    Thanks @jeanfabre, i am waiting for you
  • jeanfabre
    jeanfabre mod
    edited October 2016
    Options
    Hi,

    ok, found the issue. It will be in the next update ( for real this time :) hopefully )

    If you don't want to wait, the fix is easy.

    locate the method HandleEventLeave in NetworkingPeer.cs and change
    
    if (player.isInactive)
                {
                    Debug.LogWarning("HandleEventLeave for player ID: " + actorID + " isInactive: " + player.isInactive + ". Stopping handling if inactive.");
                    return;
                }
    
    to
    
    if (player.isInactive && _isAlreadyInactive)
                {
                    Debug.LogWarning("HandleEventLeave for player ID: " + actorID + " isInactive: " + player.isInactive + ". Stopping handling if inactive.");
                    return;
                }
    
    Bye,

    Jean
  • antigode
    antigode
    edited June 2019
    Options
    I still have this issue with the latest release of the realtime SDK. (this is NOT about PUN). When OnPlayerLeftRoom is triggered by the former master client, it tells that he is active while it shouldn't be. Did you actually fixe it ?

    PS: It's written
    The former MasterClient is still in the player list when this method get called.
    for the OnMasterClientSwitched but when i am iterating on CurrentRoom.Players in this callback, i don't have the former master client anymore. I don't understand
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2019
    Options
    Hi @antigode,

    I did not understand your description of the issue.

    What is the Unity Realtime SDK version you are using?

    What is the expected behaviour and the actual behaviour?
    What are the minimal repro steps?
  • antigode
    Options
    For the initial issue, the mistake was from me. But i still have the second issue so my question is: in the OnMasterClientSwitched callback, in the currentroom.players, is the former master client still there ? Because i don't have it anymore while it seems in the documentation that i should still have it.