Photon Loadbalancing Errors Spam

edited October 2018 in Photon Server
I am using Photon Server. Periodically I can see the "Can't optimise broadcast to disparate peers" error. I couldn't find anything on google. So does anybody know what problem it is and how to fix it?
Sometimes clients can't connect to master for 10+ minutes. I think that this error can be the source of my problem


  • hi, @Sergey

    Do you have different clients which use either binary protocol or JSON protocol?

  • Thanks for an answer, @chvetsov
    All of our clients are using binary protocol
  • >Can't optimise broadcast to disparate peers

    this bug is some internal issue of managed part of photon socket server. It does not break anything. this is rather a performance issue. Also, it is not the reason why you cannot connect to the master server.

    Please check that you do not set AutoJoinLobby flag. Usually this is an issue, because master starts to send to clients all rooms in lobby and this takes ages and kills clients

  • Yes, you're right. We are using AutoJoinLobby flag because there is only one lobby on our server.
    Average online ~500 clients, max players in room always equal to 2, so the average count of rooms is 250+-
    Also I want to say that we are using SqlLobby type (maybe this information could be useful).
    Can you please explain why sending all rooms to clients takes a lot of time?

    P.S. Sometimes on PhotonLoadBalancing logs I can see these messages
    "CTCPWebSocketServer::ReadCompleted - Exception - TWebSocketBase::Read() - Socket is closed: 0000000009DB5A30"
    "CTCPSocketServer::OnError() - TAsyncSocket::Shutdown() - An existing connection was forcibly closed by the remote host."
    "CTCPSocketServer::OnWriteCompletionError() - Flow control - Connection aborted due to - An existing connection was forcibly closed by the remote host."
    Are those errors part of our issue or they can be ignored?

    Thanks again for you help, @chvetsov
    Much appreciated!
  • >Are those errors part of our issue or they can be ignored?
    they can be ignored.

    well, if you have just 250 rooms this should not be an issue. probably you also generate a lot of updates for lobby properties. So that rooms are updated constantly.

    Not sure what else it can be. Next time when you see this issue (client is not being able to connect to master), please try to connect with a modified client, which does not use AutoJoinLobby. If it works, then that is the issue. if not we will dig more

    All more or less successful titles face the same issue with AutoJoinLobby.

  • SergeySergey
    edited November 2018
    Thanks for help again @chvetsov
    It's turned out that there was unoptimised query to database server before getting information about all the lobbies.
    How can I close discussion?
  • hi, @Sergey
    You should not do anything special. We are glad to know that you managed to find a reason for your issue

  • hello, @chvetsov
    Today I had the same issue with lobby
    I've used console turn based client and made some debug logs on joining to lobby to check what goes wrong in this situation
    So I don't get response on OpJoinLobby command on the client side
    On the server side there were no bottlenecks (HandleJoinLobby method successfully queueing to fiber and executing without any problems)
    But I have feeling that here:

    var subscription = this.GameList.AddSubscription(peer, operation.GameProperties, operation.GameListCount);
    peer.GameChannelSubscription = subscription;
    peer.SendOperationResponse(new OperationResponse(operation.OperationRequest.OperationCode), sendParameters);

    SendOperationResponse method have some problems. Somehow method
    peer.SendEvent(eventData, new SendParameters());
    which is calling from HandleJoinLobby(it is called after SendOperationResponse) works fine and I can get this event on the client side
    Do you have any thoughts on this problem? Would be much appreciated for any advice!
  • chvetsovchvetsov mod
    edited January 24
    Hi, @Sergey

    Please create a separate topic for new questions. This will save our time. In regard to your question: Please check return values from that methods. Did they manage to send? What is the size of the messages you are trying to send? Also, if you have updated our code, it could be that you inserted something unsupported by our protocol and message was discarded either on server or client side

  • Hello, @chvetsov
    Thanks for an answer! I'll check everything you mentioned. I'll create a new topic with more info about this issue as you said
Sign In or Register to comment.