Weird client state transitions (DISCONNECTED -> JOINED)

edited January 2014 in Native
I am experiencing weird behavior when running our tests (Android NDK library, Photon-AndroidNDK_v3-2-2-0_Cloud_SDK)

The issue i'm seeing when calling createRoom.

We are monitoring the client state and print out every state change.

On a few occasions i'm seeing the client state goes from DISCONNECTED to JOINED.

The flow goes like this:

1. Connect
2. Waiting until state is CONNECTED.
3. Call createRoom
4. Client halts in JOINING state for ~ 10 seconds (*we have a timer to check for this case)
5. Shortly after we're getting a disconnection (error 1040) - connection state changes to state 8 (DISCONNECTED)
6. around 500 ms later getting a debug printout from the native lib (game room created)
7. Client state changes to 4 (JOINED)

How is it possible that we're observing a disconnection (error 1040) followed by JOINED?

Is this a bug that you're familiar with ? What can we further do to investigate this issue ?

Vielen Dank,


  • Hi Lior.

    When joining or leaving a game room then under the hood the client will also switch between master server and game server, meaning, it's disconnecting from one an reconnecting to another Photon server instance.

    My guess is, that you get a timeout disconnect from the master server for some unknown reason just when the client is already on the road to switch servers and has already received the information to which gameserver instance it should switch to and when its therefor also regularly disconnecting from the master server, so that it expects to get disconnected from the master. Looks like that server switch flow logic does not cover the case of getting a timeout disc in between and inthat case does both, throwing the error like for an *official* disc, and continuing with the joining procedure, like if it would have been a normal server-switch disc.

    I am afraid, that I can't really look into this topic this week, as I am out of office for the rest of the week, but I will point a colleague to this thread and maybe he will find some time for it this week. Otherwise I plan to come back to you next week (please remind me about this topic, if I should forget about it).
  • Thanks. Any help will be appreciated by you or anyone else. Let me know what more can we provide or what test case can be used?
  • 1. Current sdk is
    Yours looks slightly outdated. Can you update to latest?
    2. Do you get those results running demo_loadBalancing from sdk package? States you mentioned are demo-specific, not part of SDK.
    For me this test (run on windows) gives demo states sequence: 1, 2 , 3, 4 or STATE_CONNECTING, STATE_CONNECTED, STATE_JOINING, STATE_JOINED.
    3. What server do you connect?
  • 1. I will try to update and run again.
    2. What demo loadbalancing? The NDK library comes with a sample Android app, is that the one you mean? it runs fine, but the issue seems to be a bit random (doesn't occur on every attempt) so i'm not sure we'll be able to reproduce it with the demo.
    3. Usually we connect to EU server.

    Again, i'm stressing out that the issue was seen once or twice so far.
  • Yes, that's the demo he is talking about.

    A reproduction case based on the demo would be a great help to tackle this down.
Sign In or Register to comment.