Last operation details

Options
Hi everyone,

I've noticed in my app that sometimes, the MasterClient gets disconnected from the server when a second player joins the room. From the server logs, this is due to a message being too big:
Total message too big: 526018 max is: 512000 peer disconnected

I'm not sure whether it exceeds the MaxMessageSize or the MaxQueuedDataPerPeer in the the PhotonServer.config.
It could either mean that one message was actually of 526018 bytes or that too many messages were sent and overflowed the peer buffer before the server had time to process them.

Anyways, back in the Unity Editor, I could confirm that when the second player joins, ByteCountLastOperation is abnormally high (~200k bytes) for the MasterClient. I've logged it in an OnGUI function so I'm not sure for how many operations the ByteCount was too high. It shows the same value 5-10 times in a row but I don't think that necessarily means that there are 5-10 messages of 200k bytes being sent (This would well be OnGUI being called several times in a frame). This happens right after the OnPhotonPlayerConnected event.

I've commented out all my RPC calls and OnPhotonSerializeView events so my code shouldn't send any data.

What is the best way to identify what script/function is responsible for that "operation" (from ByteCountLastOperation ) that sends a message (a few messages?) so big that it disconnects the player? Can I see the list of all the operations and their byte count performed by PUN? I'd love to have some stack trace so I can go back to whatever function is responsible for this oversized ByteCountLastOperation.

I'd like to understand if that comes from my scripts, some Photon Voice initialization, or any other Photon mechanisms than run in the background.

Many thanks!

Comments

  • Tobias
    Options
    That's an interesting case.

    There is no built-in log-all switch to track everything you send. The assumption is that you'd nomally don't have to chase this down.
    You should be able to add something suitable quickly, as all communication (RPCs and OnPhotonSerializeView) will call the lower level method RaiseEvent. In LoadBalancingPeer.OpRaiseEvent(), cache the operation before it calls SendOperation(). Don't return it's value right away but instead check ByteCountLastOperation and if that's too high, log the operation.
  • BlastOff
    Options
    Hi Tobias,

    Thanks for the advice.
    In case someone else has this problem:
    I've managed to identify what the issue was. I was calling PhotonNetwork.Instantiate() to instantiate an avatar prefab on OnJoinedroom. Turned out I was recording and storing the player's position even though no other player was connected. I think this caused my internal position buffer to grow as OnPhotonSerializeView was not being called and therefore my buffer was not being flushed. When the second player would join, the photon view would send that big buffer, causing the huge message and resulting in the disconnection of the master client.