DisconnectByServerLogic in a few seconds after running PhotonView.RPC



Using PUN2, when I run PhotonView.RPC() after creating and entering a room with matchmaking, I get the following log output and disconnection from the server after about 5 seconds.

SocketUdp, .Net, Unity.

IPhotonSocket.Connect() ns.photonengine.io:5058 this.Protocol: Udp

SendOutgoingCommands ignored socket is not connected. pid:65535

ns.photonengine.io resolved to 1 address(es): (InterNetwork(2))

Resending: CMD(6 ch#/sq#/usq#: 0/1/0 r#/st/tt:1/164/30164). times out after: 35 sent: 164 now: 214 rtt/var: 15/5 last recv: 59

Connected to nameserver.

Resending: CMD(6 ch#/sq#/usq#: 0/2/0 r#/st/tt:1/1203/31203). times out after: 49 sent: 1203 now: 1269 rtt/var: 17/8 last recv: 86

Resending: CMD(12 ch#/sq#/usq#: 255/2/0 r#/st/tt:1/1203/31203). times out after: 49 sent: 1203 now: 1269 rtt/var: 17/8 last recv: 86


Resending: CMD(12 ch#/sq#/usq#: 255/3/0 r#/st/tt:1/1303/31303). times out after: 49 sent: 1303 now: 1372 rtt/var: 29/28 last recv: 1

Received your UserID from server. Updating local value to: 9e24310d-f697-415f-b161-ad39cdc001f8


IPhotonSocket.Connect() this.Protocol: Udp

Connected to masterserver.

[1:42.42] SupportLogger OnConnected().

[1:42.42] SupportLogger Info: AppID: "**********" AppVersion: "1.0" Client: v4.1.6.17 (NetStandard20) Build: 2021.3.8f1, WindowsEditor, ENABLE_MONO, DEBUG, NET_STANDARD_2_0 Socket: SocketUdp UserId: "9e24310d-f697-415f-b161-ad39cdc001f8" AuthType: Oculus AuthMode: Auth PayloadEncryption State: ConnectingToMasterServer PeerID: 38681 NameServer: ns.photonengine.io Current Server: IP: Region: jp 

[1:43.43] SupportLogger OnConnectedToMaster().

[1:52.52] SupportLogger Rtt(variance): 18(8). Since receive: 666ms. Longest send: 1ms. Stats elapsed: 10sec.

Longest delta between Send: 38ms Dispatch: 34ms. Longest callback OnEv: 226=3ms OnResp: 0=2ms. Calls of Send: 569 Dispatch: 804. Ping min/max: 14/19


Resending: CMD(5 ch#/sq#/usq#: 255/16/0 r#/st/tt:1/14533/44533). times out after: 51 sent: 14533 now: 14600 rtt/var: 19/8 last recv: 90

Resending: CMD(6 ch#/sq#/usq#: 0/4/0 r#/st/tt:1/14540/44540). times out after: 51 sent: 14540 now: 14600 rtt/var: 19/8 last recv: 90

Resending: CMD(5 ch#/sq#/usq#: 255/16/0 r#/st/tt:2/14600/44533). times out after: 51 sent: 14600 now: 14701 rtt/var: 19/8 last recv: 191

Resending: CMD(6 ch#/sq#/usq#: 0/4/0 r#/st/tt:2/14600/44540). times out after: 51 sent: 14600 now: 14701 rtt/var: 19/8 last recv: 191

IPhotonSocket.Connect() this.Protocol: Udp

Connected to gameserver.


[1:57.57] SupportLogger OnJoinedRoom(Room: '5041875669206647_08DAB73FCD6B5DF3' visible,open 1/8 players.). GameServer:

<<<< executing PhotonView.RPC() >>>>

Server sent disconnect. PeerId: 38767 RTT/Variance:15/6 reason byte: 1 peerConnectionState: Connected

[2:2.2] SupportLogger OnLeftRoom().

[2:2.2] SupportLogger OnDisconnected(DisconnectByServerLogic).

For example, execute the following simple RPC only once

m_photonView.RPC(nameof(ExecRPC), RpcTarget.Others, 10, 10, 100 /*or byte[]*/);


void ExecRPC(long arg1, long arg2, int data /*byte[] data*/)


  Debug.Log($"Execute RPC Command, value = {data}.");


Then, after a few seconds, a disconnect occurs as shown in the log above.

I understand that DisconnectByServerLogic occurs when the communication volume is too large, etc., but in this example, the communication volume is so small that it does not seem to apply.

I also suspect that it is related to the fact that there are no other players in the room, so I executed RPC after additional players entered the room, and the same disconnection occurred. I have already set the ViewID in PhotonView. In addition, LoadBalancingClient.Service() is running 30 times per second.

What could be the cause of such disconnections?

I would appreciate any clues or advice on how to investigate.


  • Tatsuhiro

    I also tried the PunBasics-Launcher, a sample that comes with the PUN2 plug-in.


    When I clicked the Play button to start the scene, the same disconnection occurred within a few seconds.

    Considering that the disconnection occurs even in the official sample scene as it is, I wonder if this is a problem with the execution environment or PhotonServerSettings.

    The log just before the disconnection is as follows:

    Registered PhotonView: 1001
    [1:57.57] SupportLogger OnRoomPropertiesUpdate(propertiesThatChanged).
    Server sent disconnect. PeerId: 28438 RTT/Variance:19/9 reason byte: 1 peerConnectionState: Connected
  • Tatsuhiro

    Sorry, I solved it myself.

    The cause was that the Photon Cloud Application used was for FUSION, which was created at the time of verification.

    When I re-created the application for PUN and specified it, this disconnection phenomenon disappeared.

    I did not notice the problem because the connection to the master server and authentication were working fine with the FUSION application.

  • Tobias

    Glad you found this cause and fixed it.

    I will check if we can provide a clearer error message when this happens.