Forum C# Room active with no connections

Room active with no connections

Postby azuanagames » October 19th, 2010, 5:55 am

I'm currently in the middle of debugging new server and client code, so I have the development server running in the debugger. I had mentioned before that I was witnessing rooms that had no players in them continue to run. Well I was just able to replicate it on the development server. PlayerCount is 0, yet timers continue to fire.

Could this be my fault for not killing a timer? Or should those timers die on their own once PlayerCount hits 0?

I can't reproduce the error on demand. It may have to do with a disconnect while joining the room.

P.S. It won't help right now because they won't be there when you check, but, I have 3 rooms active with no players in them...
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby azuanagames » October 19th, 2010, 7:02 am

Ok, I can reproduce this 100%...

I have the online status of a player in BigDB. When a user joins I check if they are already in a room using BigDB in the AllowUserJoin function.

If I connect twice, the second connection gets kicked off due to the above check. Once that happens the server is in crazy mode. I manually disconnect the first client. Then I wait a bit and the server shows no players on but the game is never closed.

I then re-connect and the game is already running. I don't seem to get a UserJoined event. (I have to verify this, I have an init message that gets sent in UserJoined, but I'm seeing other messages come before the init. Which causes a crash in my client, since it expects init first.)

Another sure fire way to make the server get stuck is to simply return false from AllowUserJoin. The room stays open and doesn't close when the player is kicked off.

Will report more as I try to figure out the problem.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby Oliver » October 22nd, 2010, 2:43 pm

Hey, that sounds absolutely crazy.

Could you send us the project you're using, or a smaller test-case we can use to fix the issue?
If you're feeling particularly helpful, a small screen cast of you deliberately causing the issue would be very helpful

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Room active with no connections

Postby azuanagames » October 22nd, 2010, 5:56 pm

I'll try to reproduce this in a smaller example and will send it to you.

I was mistaken about never getting the UserJoin event, I am getting the UserJoin. But the server definitely gets stuck open when I return false from the AllowUserJoin.

Hope to have something for you to look at soon.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby azuanagames » October 23rd, 2010, 3:55 am

Add the following code to your tic-tac-toe example

Code: Select all
    public override bool AllowUserJoin(Player player)
    {
      foreach (Player p in Players) {
        if (p.ConnectUserId == player.ConnectUserId) {
          return false;
        }
      }
      return true;
    }


Now connect with the same connect id, like Whatever-3232 and Whatever-3232 and join the same room. Once you get kicked off, close both clients. The server will still be running the room.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby Oliver » October 25th, 2010, 3:42 pm

Hey,

Thanks for the great error report! It really makes it much easier to find and fix issues when they're this easy to reproduce.

We reproduced the error with no problem, and have implemented a fix for it, that will be available in the next release.

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Room active with no connections

Postby azuanagames » October 25th, 2010, 5:20 pm

Out of curiosity is this bug also responsible for servers staying open for no apparent reason? I mean because of a user disconnect or some other reason not associated to the AllowUserJoin method?
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby Oliver » October 26th, 2010, 10:20 am

Hmm... i don't think so. this was an issue directly related to the use of AllowUserJoin method.
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Room active with no connections

Postby azuanagames » October 26th, 2010, 4:47 pm

Alright. I'll have to look at my other server. That server has open rooms all the time and I don't use AllowUserJoin. It has 2 rooms right now with no one in them.

There is however a bug in that server that is in the ErrorLog. null pointer usage. I'm fairly certain it has to do with that error.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby Oliver » October 26th, 2010, 7:46 pm

Paste the null error message here ?

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Room active with no connections

Postby azuanagames » October 27th, 2010, 2:45 am

Object reference not set to an instance of an object.

First seen 6 days ago, latest 17 hours ago. (delete 17 errors)

Like I've said before, I'm not so sure where to look for this. More than likely it's my bug, since my FB version doesn't give this error at all.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Room active with no connections

Postby Oliver » October 27th, 2010, 3:02 pm

Oh, i was hoping for a stacktrace :(
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Room active with no connections

Postby azuanagames » October 27th, 2010, 4:20 pm

Me too! :lol:
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm


Return to C#



cron