OpRaiseEvent Failing

edited February 2017 in DotNet

I'm using Photon with Playfab for Unity, and i'm having an intermittent problem with OpRaiseEvent failing. Sometimes it works perfectly, other times it fails with the following log:

OnOperationResponse: OperationResponse 253: ReturnCode: -2 (Unknown operation code). Parameters: {}

This is the code used to raise the event:
            new Hashtable() {
I can't work out what the issue is because there isn't really information in the error. As I say, sometimes it works flawlessly, and other times it fails consistently. I've made sure that the player is connected to a game server and has Joined a room when the event is raised, there never seems to be any issue connecting to the room before it fails (or doesn't).

I'm testing on two PCs, and the problem occurs on both.



  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @bloot (Graeme),

    Thank you for choosing Photon!

    I think what is happening is that sometimes for some reason you try to call RaiseEvent operation when not joined to a room.
    When you call RaiseEvent operation on MasterServer it throws this error.
  • Hi,

    That is indeed the problem, it was my logging throwing me off. It was showing a user had Joined, but then elsewhere there was a message stating the room was full, so there is an issue with trying to re-join a room I need to fix.

  • I've also noticed another reason it's failing is because i receive the following error:

    OperationResponse 226: returncode -3 (operation is not allowed on this join stage)

    I can't seem to find any information on why that would occur?
  • JohnTube
    JohnTube ✭✭✭✭✭
    I'm looking into it, I'll let you know.
    Meanwhile, can you tell me how to reproduce it on your end? How frequently does it happen and how?
  • Any update to this? I'm getting Operation is not allowed on this join stage in my debug return. I am connected to a room when raising events,
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @eza,

    What client SDK are you using?

    Are you getting ReturnCode -3 for Operation Code 226 (JoinRoom) or 253 (RaiseEvent) or else?
    On which server are you getting this error?

    Return Code -3 means the server did not finish processing the join room request of the client.

    Read more about this here.
  • This was caused by logging all debug info on the server, slowed the server down, error disappeared when logging was returned to 'INFO'.
  • Kaiserludi
    Kaiserludi admin
    edited March 2019
    Hi @eza.

    Are you sure that youdon't call opRaiseEvent() until you actually got the callback that informs your that you have successfully entered the room? A call to opCreateRoom(), opJoinRoom(), etc. is an asynchronous operation. The client will send a request to the master server, the master server will then respond with the address of a game server to which the client should connect, the client will then disconnect from the master and reconnect to that game server. Afterwards it will send the according request to the game server and only after the game server has responded that you have successfully entered the room, the according callback will be called to inform you about successfully entering the room. Once that is the case, the server should see you in the correct join stage for raising events, no matter how much logging goes on on the server and how much that might slow the server down.

    Raising events shortly after a call to opCreateRoom()/opJoinRoom(), but before you have received the according callback, causes undefined behavior in form of a race condition: the raise event request might be sent while you are still on the master server in which case it will fail, or while you are already on the game server, but not inside the room yet, it which case it will fail as well, or it might happen when the join has already finished on the server, but the servers response has not yet arrived on the client and the exact outcome might vary widely depending on the latency and on how much other work the server and client have to do during that time or on what hardware they run. Everything might even just work fine on your own machines, but just not on the hardware of your customers, when you assume a successful join at some point in time before you have actually received the according callback.

    If this happens for you even after you got a callback for successfully joining a room, then I would like to ask you to explain how to reproduce it (and send us a repro case if necessary), because in that case it might be a bug.
  • Sorry - you're correct - I was raising events before the callback was received, and the state changed. I wrapped it to make sure it was only sending after joining the room.

    Thanks for the explanation. Learning lots!