Bug with user ID

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

gauravS
Posts: 40
Joined: 12 Jun 2012, 07:21

Bug with user ID

Postby gauravS » 20 Jan 2013, 08:39

Hi,

I think there is a bug with user ID updation on SFS2X AS3 client side API. I checked it thrice, it can be easily replicated and it is causing my application to break :(
Here is how to reproduce it:-
Bug Scenario - Let two (say, A and B) players join in main room "The Lobby". Then B leaves the lobby and creates his own. In meantime A reloads the application where server disconnects him and he logs in again into lobby. Now B comes back to the lobby... When B tries to get the ID of user A by using sfs.userManager.getUserByName(userName).id, the API gives B the old user ID of A. Because of this private messages and other stuff is not being sent from B to A as B is having wrong ID of A... I have checked and confirmed it with server logs where it says:-

20 Jan 2013 | 03:01:32,126 | WARN | com.smartfoxserver.v2.controllers.SystemController-1 | v2.controllers.SystemController | | java.lang.IllegalArgumentException: Private Message recipient is not available. Recipient ID: 553
com.smartfoxserver.v2.controllers.system.GenericMessage.executePrivateMessage(GenericMessage.java:242)
com.smartfoxserver.v2.controllers.system.GenericMessage.execute(GenericMessage.java:122)
com.smartfoxserver.v2.controllers.SystemController.processRequest(SystemController.java:130)
com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:96)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)

But 553 was the old ID of A.

This is the second bug I have encountered with AS3 client api of SFS2x, first one I reported here - viewtopic.php?f=18&t=15526
Please confirm if this is the case. If yes, then plz fix it! Right now I am trying to figure out a workaround.

Thanks
User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

Re: Bug with user ID

Postby levancho » 20 Jan 2013, 13:14

i think i have to agree that there is a bug, but i believe it is the bug in how disconnected users are handled right now, maybe new "ghost hunter" code problem?

i beleive when user is disconnected smartfox is taking some time (more than 3-5) seconds to realize that THE use has been gone and to remove it from the system,
we also have a situation that if I close the app and try to relogin, smartfox still thinks that i am logged in, and i have ot wait about 3-5 seconds before i can login.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Bug with user ID

Postby rjgtav » 20 Jan 2013, 20:29

Hi,

Just to make sure I understood everything right:

1. A and B join the first room, "The Lobby";
2. B leaves "The Lobby" and creates a new one, let's call it "Lobby2";
3. A disconnects, logs in again, and joins "The Lobby";
4. B returns to "The Lobby", tries to retrieve A's userId, and it is the old value.

Is this the procedure to reproduce the bug?

Thanks
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
gauravS
Posts: 40
Joined: 12 Jun 2012, 07:21

Re: Bug with user ID

Postby gauravS » 21 Jan 2013, 04:44

rjgtav wrote:Hi,

Just to make sure I understood everything right:

1. A and B join the first room, "The Lobby";
2. B leaves "The Lobby" and creates a new one, let's call it "Lobby2";
3. A disconnects, logs in again, and joins "The Lobby";
4. B returns to "The Lobby", tries to retrieve A's userId, and it is the old value.

Is this the procedure to reproduce the bug?

Thanks

Hi,

Thanks for the reply. Yes that's the procedure to reproduce the bug (only in step 2, B is creating a game room, don't know if that makes any difference) provided you retrieve the user ID on AS3 client using sfs.userManager.getUserByName(userName).id. I solved my problem for time being by getting the user object from lobby room using lobby.getUserByName(userName) and the id property on this user object returns the correct id.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug with user ID

Postby Lapo » 04 Feb 2013, 08:48

I solved my problem for time being by getting the user object from lobby room using lobby.getUserByName(userName) and the id property on this user object returns the correct id.

That's correct. Users objects should be obtained from the Room's userlist at all times.
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 55 guests